Browse Source

Bug 1741: Failure in .NET assembly when ProgramFiles(x86) environment variable is not set and WinSCP executable cannot be found anywhere

https://winscp.net/tracker/1741
(cherry picked from commit 8e45684db4609b1ab9982b0fab16fcdc0866af97)

Source commit: 177a79c9c6bd33d63e550ae4c05c71cebf38076d
Martin Prikryl 6 years ago
parent
commit
97fedbbddf
1 changed files with 1 additions and 2 deletions
  1. 1 2
      dotnet/internal/ExeSessionProcess.cs

+ 1 - 2
dotnet/internal/ExeSessionProcess.cs

@@ -864,8 +864,7 @@ namespace WinSCP
             string programFiles;
             string programFiles;
             if (IntPtr.Size == 8)
             if (IntPtr.Size == 8)
             {
             {
-                // In .NET 4 we can use Environment.SpecialFolder.ProgramFilesX86
-                programFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
+                programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
             }
             }
             else
             else
             {
             {