Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
new data file
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyhu87 committed May 3, 2016
1 parent 03e617a commit 47f4d1f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
Binary file modified src/Uninstall_Wrapper/DataFile.bin
Binary file not shown.
56 changes: 25 additions & 31 deletions src/Uninstall_Wrapper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,46 +176,40 @@ private static int Main(string[] args)
private static IEnumerable<string> GetVisualStudioInstallationDirs()
{
List<string> vsDirs = new List<string>();
if (Environment.Is64BitOperatingSystem)
{
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\12.0\\",
"InstallDir",
null));
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\14.0\\",
"InstallDir",
null));
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\15.0\\",
"InstallDir",
null));
}
else
{
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\",
"InstallDir",
null));
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\",
"InstallDir",
null));
vsDirs.Add((string)Registry.GetValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\15.0\\",
"InstallDir",
null));
}

var vsVers = new string[] { "12.0", "14.0", "15.0" };

// %AppData%\Microsoft\VisualStudio\14.0 & 12.0 & 15.0
// %LocalAppData%\Microsoft\VisualStudio\14.0 & 12.0 & 15.0
// %LocalAppData%\Microsoft\VSCommon\14.0 & 12.0 & 15.0
var appDataRoot = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var localAppDataRoot = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var vsVers = new string[] { "12.0", "14.0", "15.0" };

foreach (var vsVer in vsVers)
{
if (Environment.Is64BitOperatingSystem)
{
var installDir = (string)Registry.GetValue(
string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\{0}\\", vsVer),
"InstallDir",
null);
if (!string.IsNullOrEmpty(installDir))
{
vsDirs.Add(installDir);
}
}
else
{
var installDir = (string)Registry.GetValue(
string.Format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\{0}\\", vsVer),
"InstallDir",
null);
if (!string.IsNullOrEmpty(installDir))
{
vsDirs.Add(installDir);
}
}

vsDirs.Add(Path.Combine(appDataRoot, "Microsoft", "VisualStudio", vsVer));
vsDirs.Add(Path.Combine(localAppDataRoot, "Microsoft", "VisualStudio", vsVer));
vsDirs.Add(Path.Combine(localAppDataRoot, "Microsoft", "VSCommon", vsVer));
Expand Down
2 changes: 1 addition & 1 deletion src/VS.ConfigurationManager/Primitives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void CleanupVisualStudioFolders(IEnumerable<string> vsInstallPaths)
{
try
{
if (Directory.Exists(path) && !this.DoNotExecuteProcess)
if (!string.IsNullOrEmpty(path) && Directory.Exists(path) && !this.DoNotExecuteProcess)
{
Logger.LogWithOutput(string.Format("Deleting: {0}", path));
this.RecursivelyDeleteFolder(path);
Expand Down

0 comments on commit 47f4d1f

Please sign in to comment.