diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs index 700c004a4f..a0eca6ebe6 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs @@ -36,7 +36,6 @@ using System.Drawing; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; -using Microsoft.Win32; namespace LaunchSLClient { @@ -96,9 +95,9 @@ namespace LaunchSLClient private void addLocalSandbox(ref ArrayList menuItems) { - // build sandbox URL from Regions\default.xml + // build sandbox URL from Regions/default.xml // this is highly dependant on a standard default.xml - if (File.Exists(@"Regions\default.xml")) + if (File.Exists("Regions/default.xml")) { string sandboxHostName = ""; string sandboxPort = ""; @@ -106,7 +105,7 @@ namespace LaunchSLClient Regex myRegex = new Regex(".*internal_ip_port=\\\"(?.*?)\\\".*external_host_name=\\\"(?.*?)\\\".*"); - FileInfo defaultFile = new FileInfo(@"Regions\default.xml"); + FileInfo defaultFile = new FileInfo("Regions/default.xml"); StreamReader stream = defaultFile.OpenText(); do { @@ -136,10 +135,10 @@ namespace LaunchSLClient { //build local grid URL from network_servers_information.xml // this is highly dependant on a standard default.xml - if (File.Exists(@"network_servers_information.xml")) + if (File.Exists("network_servers_information.xml")) { string text; - FileInfo defaultFile = new FileInfo(@"network_servers_information.xml"); + FileInfo defaultFile = new FileInfo("network_servers_information.xml"); Regex myRegex = new Regex(".*UserServerURL=\\\"(?.*?)\\\".*"); StreamReader stream = defaultFile.OpenText(); @@ -168,13 +167,11 @@ namespace LaunchSLClient private void addLocalSims(ref ArrayList menuItems) { - // find opensim directory - RegistryKey exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim"); - if (exeKey != null) - { - Object simPath = exeKey.GetValue("Path"); + string configDir = m_machineConfig.GetConfigDir(); - Directory.SetCurrentDirectory(simPath.ToString()); //this should be set to wherever we decide to put the binaries + if (!string.IsNullOrEmpty(configDir)) + { + Directory.SetCurrentDirectory(configDir); addLocalSandbox(ref menuItems); addLocalGrid(ref menuItems); @@ -193,10 +190,10 @@ namespace LaunchSLClient System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = runLine; - proc.StartInfo.Arguments = exeFlags.ToString() + " " + runUrl; + proc.StartInfo.Arguments = exeFlags + " " + runUrl; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = false; - proc.StartInfo.WorkingDirectory = exePath.ToString(); + proc.StartInfo.WorkingDirectory = exePath; proc.Start(); proc.WaitForExit(); } diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/MachineConfig.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/MachineConfig.cs index 68a86c4f61..fea8d5045e 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/MachineConfig.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/MachineConfig.cs @@ -33,5 +33,6 @@ namespace LaunchSLClient public abstract class MachineConfig { public abstract void GetClient(ref string exePath, ref string runLine, ref string exeFlags); + public abstract string GetConfigDir(); } } diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/OSXConfig.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/OSXConfig.cs index 60e5e484c6..0d866afe86 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/OSXConfig.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/OSXConfig.cs @@ -46,5 +46,10 @@ namespace LaunchSLClient runLine = exePath + "/Second Life"; exeFlags = ""; } + + public override string GetConfigDir() + { + return ""; + } } } diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/UnixConfig.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/UnixConfig.cs index eb5342f2c5..220ad82070 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/UnixConfig.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/UnixConfig.cs @@ -38,5 +38,10 @@ namespace LaunchSLClient runLine = "secondlife"; exeFlags = ""; } + + public override string GetConfigDir() + { + return ""; + } } } diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/WindowsConfig.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/WindowsConfig.cs index f3b797c6ec..df56bfe3e5 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/WindowsConfig.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/WindowsConfig.cs @@ -51,5 +51,12 @@ namespace LaunchSLClient Registry.LocalMachine.Flush(); Registry.LocalMachine.Close(); } + + public override string GetConfigDir() + { + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim"); + + return key == null ? "" : key.GetValue("Path").ToString(); + } } }