Skip to content

Commit

Permalink
Added handling for case %UserProfiles%/pictures doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
T0biasCZe committed Jul 26, 2023
1 parent c86580e commit fb7ea3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AdbFileManager/AdbFileManager.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
Expand Down
17 changes: 14 additions & 3 deletions AdbFileManager/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fb7ea3e

Please sign in to comment.