Skip to content

Commit

Permalink
installer clean up chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Dec 20, 2021
1 parent a2177d3 commit 61e4b81
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions OneMoreSetupActions/Deployments/EdgeWebViewDeployment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public override bool Install()
logger.WriteLine(exc);
}

// deprecate
CleanupChromium();

return true;
}

Expand Down Expand Up @@ -132,7 +135,43 @@ public override bool Uninstall()
logger.WriteLine("WebView client key not found in Registry");
}

// deprecate
CleanupChromium();

return false;
}


/// <summary>
/// Temporary action to clean up the chromium folder under AppData\Roaming\OneMore.
/// This method can be removed after a few release cycles.
/// </summary>
private void CleanupChromium()
{
var path = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "OneMore");
if (!Directory.Exists(path))
{
return;
}

var chrome = Directory.GetFiles(path, "chrome.exe", SearchOption.AllDirectories).FirstOrDefault();
if (chrome == null)
{
return;
}

try
{
var parent = Path.GetDirectoryName(Path.GetDirectoryName(chrome));
logger.WriteLine($"cleaning up chromium {parent}");

Directory.Delete(parent, true);
}
catch (Exception exc)
{
logger.WriteLine("error cleaning up chromium");
logger.WriteLine(exc);
}
}
}
}

0 comments on commit 61e4b81

Please sign in to comment.