From 138e612300d659df78d2d5835f9574cfb67cf4a4 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 May 2008 17:26:35 +0000 Subject: More config cleanup in LaunchSLClient. --- .../Tools/LaunchSLClient/LaunchSLClient/Form1.cs | 25 ++++++++++------------ .../LaunchSLClient/LaunchSLClient/MachineConfig.cs | 1 + .../LaunchSLClient/LaunchSLClient/OSXConfig.cs | 5 +++++ .../LaunchSLClient/LaunchSLClient/UnixConfig.cs | 5 +++++ .../LaunchSLClient/LaunchSLClient/WindowsConfig.cs | 7 ++++++ 5 files changed, 29 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs index 700c004..a0eca6e 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 68a86c4..fea8d50 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 60e5e48..0d866af 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 eb5342f..220ad82 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 f3b797c..df56bfe 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(); + } } } -- cgit v1.1