diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2012-06-01 01:48:23 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2012-06-01 03:55:48 +0400 |
commit | 85574ee838fc83da92c0bc9293529380565260d9 (patch) | |
tree | a981b2cbd22418ee024aa56e4505dc221f1111af /main/src | |
parent | 21d6f6b62ed2709ba429e9fa38adde1528986810 (diff) |
Clean up WinXP 32-bit ProgramFilesX86 workarounds
Diffstat (limited to 'main/src')
5 files changed, 46 insertions, 18 deletions
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs index bc42c264a1..637f4a48ca 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs @@ -134,14 +134,18 @@ namespace MonoDevelop.Gettext // on Windows, we support using gettext from http://gnuwin32.sourceforge.net/packages/gettext.htm static FilePath overrideToolsLocation = FilePath.Null; - + + // ProgramFilesX86 is broken on 32-bit WinXP, this is a workaround + static string GetProgramFilesX86 () + { + return Environment.GetFolderPath (IntPtr.Size == 8? + Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + } + static Translation () { if (Platform.IsWindows) { - //On WinXP 32-bit, ProgramFilesX86 is null - FilePath programFiles = Environment.GetFolderPath (IntPtr.Size == 8? - Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); - var toolsBin = programFiles.Combine ("GnuWin32", "bin"); + FilePath toolsBin = Path.Combine (GetProgramFilesX86 (), "GnuWin32", "bin"); if (File.Exists (toolsBin.Combine ("msgfmt.exe"))) { overrideToolsLocation = toolsBin; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetFrameworkBackend.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetFrameworkBackend.cs index b1b61a52c1..878929adfa 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetFrameworkBackend.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetFrameworkBackend.cs @@ -93,14 +93,21 @@ namespace MonoDevelop.Core.Assemblies yield return s; yield return PropertyService.EntryAssemblyPath; } + + // ProgramFilesX86 is broken on 32-bit WinXP, this is a workaround + static string GetProgramFilesX86 () + { + return Environment.GetFolderPath (IntPtr.Size == 8? + Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + } IEnumerable<string> GetFrameworkToolsPaths () { //FIXME: use the toolversion from the project file TargetFrameworkToolsVersion toolsVersion = framework.GetToolsVersion (); - - string sdkPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), - "Microsoft SDKs", "Windows"); + + string programFilesX86 = GetProgramFilesX86 (); + string sdkPath = Path.Combine (programFilesX86, "Microsoft SDKs", "Windows"); switch (toolsVersion) { case TargetFrameworkToolsVersion.V1_1: diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntime.cs index 94605f7659..fd79bd6989 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntime.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntime.cs @@ -40,18 +40,21 @@ namespace MonoDevelop.Core.Assemblies bool running; MsNetExecutionHandler execHandler; string winDir; + + // ProgramFilesX86 is broken on 32-bit WinXP, this is a workaround + static string GetProgramFilesX86 () + { + return Environment.GetFolderPath (IntPtr.Size == 8? + Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + } public MsNetTargetRuntime (bool running) { winDir = Path.GetFullPath (Environment.SystemDirectory + "\\.."); rootDir = winDir + "\\Microsoft.NET\\Framework"; - // ProgramFilesX86 is broken on 32-bit WinXP - string programFilesX86 = Environment.GetFolderPath ( - IntPtr.Size == 8? Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); - + string programFilesX86 = GetProgramFilesX86 (); newFxDir = programFilesX86 + "\\Reference Assemblies\\Microsoft\\Framework"; - msbuildDir = programFilesX86 + "\\MSBuild"; this.running = running; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs index 4b261e3b45..bee8b0edc5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs @@ -107,6 +107,13 @@ namespace MonoDevelop.Ide.Gui.OptionPanels MonoTargetRuntime.UnregisterRuntime (tr); } + + // ProgramFilesX86 is broken on 32-bit WinXP, this is a workaround + static string GetProgramFilesX86 () + { + return Environment.GetFolderPath (IntPtr.Size == 8? + Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + } protected virtual void OnButtonAddClicked (object sender, System.EventArgs e) { @@ -117,8 +124,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels //set a platform-dependent default folder for the dialog if possible if (Platform.IsWindows) { // ProgramFilesX86 is broken on 32-bit WinXP - string programFilesX86 = Environment.GetFolderPath ( - IntPtr.Size == 8? Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + string programFilesX86 = GetProgramFilesX86 (); if (!string.IsNullOrEmpty (programFilesX86) && System.IO.Directory.Exists (programFilesX86)) dlg.CurrentFolder = programFilesX86; } else { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs index 4a181c3320..4ca372fad1 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs @@ -1309,7 +1309,7 @@ namespace MonoDevelop.Ide.TypeSystem } if (MonoDevelop.Core.Platform.IsWindows) { - string windowsFileName = FindXmlDocumentation (baseName, runtime); + string windowsFileName = FindWindowsXmlDocumentation (baseName, runtime); if (File.Exists (windowsFileName)) { xmlFileName = windowsFileName; return true; @@ -1321,10 +1321,18 @@ namespace MonoDevelop.Ide.TypeSystem } #region Lookup XML documentation - static readonly string referenceAssembliesPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), @"Reference Assemblies\Microsoft\\Framework"); + + // ProgramFilesX86 is broken on 32-bit WinXP, this is a workaround + static string GetProgramFilesX86 () + { + return Environment.GetFolderPath (IntPtr.Size == 8? + Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); + } + + static readonly string referenceAssembliesPath = Path.Combine (GetProgramFilesX86 (), @"Reference Assemblies\Microsoft\\Framework"); static readonly string frameworkPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Windows), @"Microsoft.NET\Framework"); - static string FindXmlDocumentation (string assemblyFileName, MonoDevelop.Core.Assemblies.TargetRuntime runtime) + static string FindWindowsXmlDocumentation (string assemblyFileName, MonoDevelop.Core.Assemblies.TargetRuntime runtime) { string fileName; ClrVersion version = runtime != null && runtime.CustomFrameworks.Any () ? runtime.CustomFrameworks.First ().ClrVersion : ClrVersion.Default; |