/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the directory for the ConTeXt software for the XeTeX back end. /// </summary> /// /// <returns> /// name or the directory or string.Empty if the directory name isn't in the registry. /// </returns> /// ------------------------------------------------------------------------------------ public static string GetCtxDir() { object regObj; if (RegistryHelperLite.RegEntryExists(RegistryHelperLite.CompanyKeyLocalMachine, "PwCtx", "ConTeXtDir", out regObj)) { return((string)regObj); } return(""); }
private static bool HasPathwayExportBatchRegistryValueForCurrentUserRegistry() { bool isAvailable = false; try { object regObj; if (RegistryHelperLite.RegEntryExists(RegistryHelperLite.CompanyKeyCurrentUser, "Pathway", "PathwayExportBatch", out regObj)) { isAvailable = true; } } catch { } return(isAvailable); }
public static string GetSettingFilePathForParatext(string database) { // (Note that PathwayB _might_ have a project file we can poke at - no guarantee) object paraTextprojectPath; string ssfFile = database + ".ssf"; if (Common.UnixVersionCheck()) { string userName = Environment.UserName; string registryPath = "/home/" + userName + "/.config/paratext/registry/LocalMachine/software/scrchecks/1.0/settings_directory/"; while (Directory.Exists(registryPath)) { if (File.Exists(Common.PathCombine(registryPath, "values.xml"))) { XmlDocument doc = new XmlDocument(); doc.Load(Common.PathCombine(registryPath, "values.xml")); paraTextprojectPath = doc.InnerText; Environment.SetEnvironmentVariable("ParatextProjPath", paraTextprojectPath.ToString()); return(Common.PathCombine(paraTextprojectPath.ToString(), ssfFile)); } //string ParatextProjectPath = Environment.GetEnvironmentVariable("ParatextProjPath"); } } else { if (RegistryHelperLite.RegEntryExists(RegistryHelperLite.ParatextKey, "Settings_Directory", "", out paraTextprojectPath)) { string settingFilePath = Common.PathCombine((string)paraTextprojectPath, ssfFile); if (File.Exists(settingFilePath)) { return(settingFilePath); } else { return(string.Empty); } } } // not found on logical drives. Debug.WriteLine(ssfFile + " does not exist."); return(string.Empty); }
private static bool GetPathwayInstallerDirectoryForLocalMachineRegistry(out string pathwayDir) { bool isAvailable = false; pathwayDir = null; try { object regObj; if (RegistryHelperLite.RegEntryExists(RegistryHelperLite.CompanyKeyLocalMachine, "Pathway", "PathwayDir", out regObj)) { Common.SupportFolder = ""; pathwayDir = (string)regObj; isAvailable = true; } } catch { } return(isAvailable); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the directory for the Pathway application. /// </summary> /// <returns> /// name or the directory or string.Empty if the directory name isn't in the registry. /// </returns> /// ------------------------------------------------------------------------------------ public static string GetPathwayDir() { string pathwayDir = string.Empty; object regObj; try { if (RegistryHelperLite.RegEntryExists(RegistryHelperLite.CompanyKeyCurrentUser, "Pathway", "PathwayDir", out regObj)) { Common.SupportFolder = ""; return((string)regObj); } if (Path.PathSeparator == '/' || Path.PathSeparator == ':') //Test for Linux (see: http://www.mono-project.com/FAQ:_Technical) { const string myPathwayDir = "/usr/lib/pathway"; RegistryAccess.SetStringRegistryValue("PathwayDir", myPathwayDir); Common.SupportFolder = ""; return(myPathwayDir); } if (GetPathwayInstallerDirectoryForCurrentUserRegistry(out pathwayDir)) { return(pathwayDir); } if (GetPathwayInstallerDirectoryForLocalMachineRegistry(out pathwayDir)) { return(pathwayDir); } string pathwayInstalledLocation = "C:\\Program Files (x86)\\SIL\\Pathway7\\"; if (Directory.Exists(pathwayInstalledLocation)) { Common.SupportFolder = ""; return(pathwayInstalledLocation); } pathwayInstalledLocation = "C:\\Program Files\\SIL\\Pathway7\\"; if (Directory.Exists(pathwayInstalledLocation)) { Common.SupportFolder = ""; return(pathwayInstalledLocation); } var fwKey = RegistryHelperLite.CompanyKeyLocalMachine.OpenSubKey("FieldWorks"); if (fwKey != null) { if (!RegistryHelperLite.RegEntryExists(fwKey, "8.0", "RootCodeDir", out regObj)) { if (!RegistryHelperLite.RegEntryExists(fwKey, "7.0", "RootCodeDir", out regObj)) { if (!RegistryHelperLite.RegEntryExists(fwKey, "", "RootCodeDir", out regObj)) { regObj = string.Empty; } } } pathwayDir = (string)regObj; // The next line helps those using the developer version of FieldWorks pathwayDir = pathwayDir.Replace("DistFiles", @"Output\Debug").Replace("distfiles", @"Output\Debug"); } if (!File.Exists(Common.PathCombine(pathwayDir, "PsExport.dll"))) { pathwayDir = string.Empty; } if (pathwayDir == string.Empty) { pathwayDir = Path.GetDirectoryName(Application.ExecutablePath); } // If after all this fall back code, we can't find PsExport in the resulting folder, we're in trouble //if (!File.Exists(Common.PathCombine(pathwayDir, "PsExport.dll")) && !Common.Testing) // Debug.Fail("Unable to find Pathway directory in registry."); // If the Support folder exists, it should be used. Common.SupportFolder = Directory.Exists(Common.PathCombine(Path.GetDirectoryName(pathwayDir), "PathwaySupport")) ? "PathwaySupport" : ""; } catch { } return(pathwayDir); }