diff --git a/AdbFileManager/AdbFileManager.csproj b/AdbFileManager/AdbFileManager.csproj index f5c438f..52f9dc0 100644 --- a/AdbFileManager/AdbFileManager.csproj +++ b/AdbFileManager/AdbFileManager.csproj @@ -1,7 +1,7 @@  - WinExe + Exe net7.0-windows enable true diff --git a/AdbFileManager/Form1.cs b/AdbFileManager/Form1.cs index 95b72ec..152fe68 100644 --- a/AdbFileManager/Form1.cs +++ b/AdbFileManager/Form1.cs @@ -44,9 +44,16 @@ private void verticalLabel1_Click(object sender, EventArgs e) { } private void explorerBrowser1_Load(object sender, EventArgs e) { - string path = Environment.ExpandEnvironmentVariables("%UserProfile%\\pictures\\"); - ShellObject tvojemama = ShellObject.FromParsingName(path); - explorerBrowser1.Navigate(tvojemama); + try { + string path = Environment.ExpandEnvironmentVariables("%UserProfile%\\pictures\\"); + ShellObject Shell = ShellObject.FromParsingName(path); + explorerBrowser1.Navigate(Shell); + } + catch { + string path = Environment.ExpandEnvironmentVariables("C:\\"); + ShellObject Shell = ShellObject.FromParsingName(path); + explorerBrowser1.Navigate(Shell); + } } private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { @@ -188,7 +195,11 @@ public static DataTable getDir(string directoryPath) { } } catch(Exception ex) { + ConsoleColor old = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Exception occured while parsing file list: "); Console.WriteLine(ex.ToString()); + Console.ForegroundColor = old; } } if(dgv.Rows.Count == 0) {