Skip to content

Commit cd0637f

Browse files
committed
Installer: Better logging when deleting existing installtion.
1 parent 1938551 commit cd0637f

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

StreamDeckSimHub.Installer/Actions/InstallStreamDeckPlugin.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,22 @@ private bool DeleteExistingInstallation(string pluginDir)
4141
{
4242
try
4343
{
44-
// Delete all files in the base directory
4544
var baseDirInfo = new DirectoryInfo(pluginDir);
45+
46+
// Delete all files in the base directory.
47+
// This is where most user issues arise, which is why we keep very detailed logs here.
4648
foreach (var fileInfo in baseDirInfo.EnumerateFiles())
4749
{
48-
fileInfo.Delete();
50+
try
51+
{
52+
fileInfo.Delete();
53+
}
54+
catch (Exception e)
55+
{
56+
SetAndLogError(e, $"Could not delete existing installation: File={fileInfo.FullName}, " +
57+
"Type={e.GetType().FullName}, HResult=0x{e.HResult:x8}, Message={e.Message}");
58+
return false;
59+
}
4960
}
5061

5162
// Delete all directories recursive in the base directory - except "images"
@@ -65,7 +76,8 @@ private bool DeleteExistingInstallation(string pluginDir)
6576
}
6677
catch (Exception e)
6778
{
68-
SetAndLogError(e, $"Could not delete existing installation: {e.Message}");
79+
SetAndLogError(e, $"Could not delete existing installation: File=(subdirectory), " +
80+
"Type={e.GetType().FullName}, HResult=0x{e.HResult:x8}, Message={e.Message}");
6981
return false;
7082
}
7183
}

0 commit comments

Comments
 (0)