diff options
author | Brian McBee | 2007-08-03 18:01:55 +0000 |
---|---|---|
committer | Brian McBee | 2007-08-03 18:01:55 +0000 |
commit | 599a6d32eebc451f9284db8e6abf2946f236d5e9 (patch) | |
tree | 60ca29aaa58b0cf34b5f0514c95229602036895c | |
parent | Yet another commit related to the SceneObject rewrites. (diff) | |
download | opensim-SC-599a6d32eebc451f9284db8e6abf2946f236d5e9.zip opensim-SC-599a6d32eebc451f9284db8e6abf2946f236d5e9.tar.gz opensim-SC-599a6d32eebc451f9284db8e6abf2946f236d5e9.tar.bz2 opensim-SC-599a6d32eebc451f9284db8e6abf2946f236d5e9.tar.xz |
Changes to prepare for future possible configuration of separate logdir, configdir, datadir.
-rw-r--r-- | OpenSim/Framework/Configuration/XML/XmlConfiguration.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Console/LogBase.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/EstateSettings.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 34 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 12 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Main.cs | 10 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs | 4 | ||||
-rw-r--r-- | prebuild.xml | 1 |
11 files changed, 95 insertions, 18 deletions
diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index 72faed6..ffb24ff 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs | |||
@@ -31,6 +31,7 @@ using System.Xml; | |||
31 | 31 | ||
32 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Configuration.Interfaces; | 33 | using OpenSim.Framework.Configuration.Interfaces; |
34 | using OpenSim.Framework.Utilities; | ||
34 | 35 | ||
35 | namespace OpenSim.Framework.Configuration | 36 | namespace OpenSim.Framework.Configuration |
36 | { | 37 | { |
@@ -119,6 +120,11 @@ namespace OpenSim.Framework.Configuration | |||
119 | 120 | ||
120 | public void Commit() | 121 | public void Commit() |
121 | { | 122 | { |
123 | if (!Directory.Exists(Util.configDir())) | ||
124 | { | ||
125 | Directory.CreateDirectory(Util.configDir()); | ||
126 | } | ||
127 | |||
122 | doc.Save(fileName); | 128 | doc.Save(fileName); |
123 | } | 129 | } |
124 | 130 | ||
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index a088af8..a090377 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs | |||
@@ -63,6 +63,7 @@ namespace OpenSim.Framework.Console | |||
63 | } | 63 | } |
64 | 64 | ||
65 | System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); | 65 | System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); |
66 | |||
66 | Log = File.AppendText(LogFile); | 67 | Log = File.AppendText(LogFile); |
67 | Log.WriteLine("========================================================================"); | 68 | Log.WriteLine("========================================================================"); |
68 | Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString()); | 69 | Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString()); |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 1a3bcb9..ef4211e 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework.Utilities; | ||
30 | 32 | ||
31 | namespace OpenSim.Framework.Data.DB4o | 33 | namespace OpenSim.Framework.Data.DB4o |
32 | { | 34 | { |
@@ -45,7 +47,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
45 | /// </summary> | 47 | /// </summary> |
46 | public void Initialise() | 48 | public void Initialise() |
47 | { | 49 | { |
48 | manager = new DB4oUserManager("userprofiles.yap"); | 50 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); |
49 | } | 51 | } |
50 | 52 | ||
51 | /// <summary> | 53 | /// <summary> |
diff --git a/OpenSim/Framework/General/Types/EstateSettings.cs b/OpenSim/Framework/General/Types/EstateSettings.cs index 11594fd..ae61752 100644 --- a/OpenSim/Framework/General/Types/EstateSettings.cs +++ b/OpenSim/Framework/General/Types/EstateSettings.cs | |||
@@ -25,9 +25,11 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | using System.IO; | |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Configuration; | 30 | using OpenSim.Framework.Configuration; |
31 | using OpenSim.Framework.Utilities; | ||
32 | |||
31 | namespace OpenSim.Framework.Types | 33 | namespace OpenSim.Framework.Types |
32 | { | 34 | { |
33 | public class EstateSettings | 35 | public class EstateSettings |
@@ -554,7 +556,7 @@ namespace OpenSim.Framework.Types | |||
554 | private ConfigurationMember configMember; | 556 | private ConfigurationMember configMember; |
555 | public EstateSettings() | 557 | public EstateSettings() |
556 | { | 558 | { |
557 | configMember = new ConfigurationMember("estate_settings.xml", "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); | 559 | configMember = new ConfigurationMember(Path.Combine(Util.configDir(),"estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); |
558 | configMember.performConfigurationRetrieve(); | 560 | configMember.performConfigurationRetrieve(); |
559 | } | 561 | } |
560 | 562 | ||
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index b9f8e9c..f3e2a01 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Security.Cryptography; | 30 | using System.Security.Cryptography; |
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Text; | 32 | using System.Text; |
@@ -275,6 +276,39 @@ namespace OpenSim.Framework.Utilities | |||
275 | return null; | 276 | return null; |
276 | } | 277 | } |
277 | 278 | ||
279 | // | ||
280 | // directory locations | ||
281 | // | ||
282 | public static string homeDir() | ||
283 | { | ||
284 | string temp; | ||
285 | // string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); | ||
286 | // temp = Path.Combine(personal,".OpenSim"); | ||
287 | temp="."; | ||
288 | return temp; | ||
289 | } | ||
290 | |||
291 | public static string configDir() | ||
292 | { | ||
293 | string temp; | ||
294 | temp = "."; | ||
295 | return temp; | ||
296 | } | ||
297 | |||
298 | public static string dataDir() | ||
299 | { | ||
300 | string temp; | ||
301 | temp = "."; | ||
302 | return temp; | ||
303 | } | ||
304 | |||
305 | public static string logDir() | ||
306 | { | ||
307 | string temp; | ||
308 | temp = "."; | ||
309 | return temp; | ||
310 | } | ||
311 | |||
278 | public Util() | 312 | public Util() |
279 | { | 313 | { |
280 | 314 | ||
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 92d5490..b581a1e 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -34,6 +34,7 @@ using libsecondlife; | |||
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Framework.Utilities; | ||
37 | 38 | ||
38 | namespace OpenSim.Grid.AssetServer | 39 | namespace OpenSim.Grid.AssetServer |
39 | { | 40 | { |
@@ -71,7 +72,11 @@ namespace OpenSim.Grid.AssetServer | |||
71 | 72 | ||
72 | private OpenAsset_Main() | 73 | private OpenAsset_Main() |
73 | { | 74 | { |
74 | m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); | 75 | if(!Directory.Exists(Util.logDir())) |
76 | { | ||
77 | Directory.CreateDirectory(Util.logDir()); | ||
78 | } | ||
79 | m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-AssetServer-console.log")), "OpenAsset", this, false); | ||
75 | MainLog.Instance = m_console; | 80 | MainLog.Instance = m_console; |
76 | } | 81 | } |
77 | 82 | ||
@@ -154,10 +159,11 @@ namespace OpenSim.Grid.AssetServer | |||
154 | 159 | ||
155 | public void setupDB() | 160 | public void setupDB() |
156 | { | 161 | { |
157 | bool yapfile = File.Exists("gridassets.yap"); | 162 | string yappath=(Path.Combine(Util.dataDir(),"gridassets.yap")); |
163 | bool yapfile = File.Exists(yappath); | ||
158 | try | 164 | try |
159 | { | 165 | { |
160 | db = Db4oFactory.OpenFile("gridassets.yap"); | 166 | db = Db4oFactory.OpenFile(yappath); |
161 | MainLog.Instance.Verbose("storage", "Main.cs:setupDB() - creation"); | 167 | MainLog.Instance.Verbose("storage", "Main.cs:setupDB() - creation"); |
162 | } | 168 | } |
163 | catch (Exception e) | 169 | catch (Exception e) |
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index f9accab..ecf3b9d 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Threading; | 32 | using System.Threading; |
32 | using System.Timers; | 33 | using System.Timers; |
@@ -34,6 +35,7 @@ using OpenSim.Framework.Console; | |||
34 | using OpenSim.Framework.Interfaces; | 35 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.Configuration; | 37 | using OpenSim.Framework.Configuration; |
38 | using OpenSim.Framework.Utilities; | ||
37 | 39 | ||
38 | using Timer=System.Timers.Timer; | 40 | using Timer=System.Timers.Timer; |
39 | 41 | ||
@@ -84,7 +86,11 @@ namespace OpenSim.Grid.GridServer | |||
84 | 86 | ||
85 | private OpenGrid_Main() | 87 | private OpenGrid_Main() |
86 | { | 88 | { |
87 | m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); | 89 | if (!Directory.Exists(Util.logDir())) |
90 | { | ||
91 | Directory.CreateDirectory(Util.logDir()); | ||
92 | } | ||
93 | m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-gridserver-console.log")), "OpenGrid", this, false); | ||
88 | MainLog.Instance = m_console; | 94 | MainLog.Instance = m_console; |
89 | 95 | ||
90 | 96 | ||
@@ -104,7 +110,7 @@ namespace OpenSim.Grid.GridServer | |||
104 | public void Startup() | 110 | public void Startup() |
105 | { | 111 | { |
106 | 112 | ||
107 | this.Cfg = new GridConfig("GRID SERVER","GridServer_Config.xml"); //Yeah srsly, that's it. | 113 | this.Cfg = new GridConfig("GRID SERVER",(Path.Combine(Util.configDir(),"GridServer_Config.xml"))); //Yeah srsly, that's it. |
108 | if (setuponly) Environment.Exit(0); | 114 | if (setuponly) Environment.Exit(0); |
109 | 115 | ||
110 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | 116 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 32d8da9..04f45b0 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
@@ -64,7 +65,11 @@ namespace OpenSim.Grid.UserServer | |||
64 | 65 | ||
65 | private OpenUser_Main() | 66 | private OpenUser_Main() |
66 | { | 67 | { |
67 | m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); | 68 | if (!Directory.Exists(Util.logDir())) |
69 | { | ||
70 | Directory.CreateDirectory(Util.logDir()); | ||
71 | } | ||
72 | m_console = new LogBase((Path.Combine(Util.logDir(),"opengrid-userserver-console.log")), "OpenUser", this , false); | ||
68 | MainLog.Instance = m_console; | 73 | MainLog.Instance = m_console; |
69 | } | 74 | } |
70 | 75 | ||
@@ -80,7 +85,7 @@ namespace OpenSim.Grid.UserServer | |||
80 | 85 | ||
81 | public void Startup() | 86 | public void Startup() |
82 | { | 87 | { |
83 | this.Cfg = new UserConfig("USER SERVER", "UserServer_Config.xml"); | 88 | this.Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); |
84 | 89 | ||
85 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | 90 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); |
86 | m_userManager = new UserManager(); | 91 | m_userManager = new UserManager(); |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index f830978..fbd6790 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim | |||
68 | protected List<IScene> m_localScenes = new List<IScene>(); | 68 | protected List<IScene> m_localScenes = new List<IScene>(); |
69 | 69 | ||
70 | private bool m_silent; | 70 | private bool m_silent; |
71 | private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; | 71 | private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); |
72 | 72 | ||
73 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName) | 73 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName) |
74 | :base( ) | 74 | :base( ) |
@@ -87,7 +87,11 @@ namespace OpenSim | |||
87 | /// </summary> | 87 | /// </summary> |
88 | public override void StartUp() | 88 | public override void StartUp() |
89 | { | 89 | { |
90 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); | 90 | if (!Directory.Exists(Util.logDir())) |
91 | { | ||
92 | Directory.CreateDirectory(Util.logDir()); | ||
93 | } | ||
94 | m_log = new LogBase(Path.Combine(Util.logDir(),m_logFilename), "Region", this, m_silent); | ||
91 | MainLog.Instance = m_log; | 95 | MainLog.Instance = m_log; |
92 | 96 | ||
93 | base.StartUp(); | 97 | base.StartUp(); |
@@ -106,12 +110,17 @@ namespace OpenSim | |||
106 | m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache); | 110 | m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache); |
107 | } | 111 | } |
108 | 112 | ||
109 | string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); | 113 | |
114 | string path = Path.Combine(Util.configDir(), "Regions"); | ||
115 | if (!Directory.Exists(path)) | ||
116 | { | ||
117 | Directory.CreateDirectory(path); | ||
118 | } | ||
110 | string[] configFiles = Directory.GetFiles(path, "*.xml"); | 119 | string[] configFiles = Directory.GetFiles(path, "*.xml"); |
111 | 120 | ||
112 | if (configFiles.Length == 0) | 121 | if (configFiles.Length == 0) |
113 | { | 122 | { |
114 | string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); | 123 | string path2 = Path.Combine(Util.configDir(), "Regions"); |
115 | string path3 = Path.Combine(path2, "default.xml"); | 124 | string path3 = Path.Combine(path2, "default.xml"); |
116 | 125 | ||
117 | RegionInfo regionInfo = new RegionInfo("DEFAULT REGION CONFIG", path3); | 126 | RegionInfo regionInfo = new RegionInfo("DEFAULT REGION CONFIG", path3); |
@@ -154,14 +163,19 @@ namespace OpenSim | |||
154 | 163 | ||
155 | protected override void Initialize() | 164 | protected override void Initialize() |
156 | { | 165 | { |
157 | m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", "network_servers_information.xml"); | 166 | m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(),"network_servers_information.xml")); |
158 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 167 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
159 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); | 168 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); |
160 | } | 169 | } |
161 | 170 | ||
162 | protected override LogBase CreateLog() | 171 | protected override LogBase CreateLog() |
163 | { | 172 | { |
164 | return new LogBase(m_logFilename, "Region", this, m_silent); | 173 | if (!Directory.Exists(Util.logDir())) |
174 | { | ||
175 | Directory.CreateDirectory(Util.logDir()); | ||
176 | } | ||
177 | |||
178 | return new LogBase((Path.Combine(Util.logDir(),m_logFilename)), "Region", this, m_silent); | ||
165 | } | 179 | } |
166 | 180 | ||
167 | # region Setup methods | 181 | # region Setup methods |
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index 38bf9bf..ea4824b 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs | |||
@@ -62,10 +62,10 @@ namespace OpenSim.Region.GridInterfaces.Local | |||
62 | { | 62 | { |
63 | bool yapfile; | 63 | bool yapfile; |
64 | this._assetRequests = new BlockingQueue<ARequest>(); | 64 | this._assetRequests = new BlockingQueue<ARequest>(); |
65 | yapfile = File.Exists("regionassets.yap"); | 65 | yapfile = File.Exists(Path.Combine(Util.dataDir(),"regionassets.yap")); |
66 | 66 | ||
67 | MainLog.Instance.Verbose("Local Asset Server class created"); | 67 | MainLog.Instance.Verbose("Local Asset Server class created"); |
68 | db = Db4oFactory.OpenFile("regionassets.yap"); | 68 | db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(),"regionassets.yap")); |
69 | MainLog.Instance.Verbose("Db4 Asset database creation"); | 69 | MainLog.Instance.Verbose("Db4 Asset database creation"); |
70 | 70 | ||
71 | if (!yapfile) | 71 | if (!yapfile) |
diff --git a/prebuild.xml b/prebuild.xml index f19248c..ab00e20 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -367,6 +367,7 @@ | |||
367 | <Reference name="System" localCopy="false"/> | 367 | <Reference name="System" localCopy="false"/> |
368 | <Reference name="System.Xml"/> | 368 | <Reference name="System.Xml"/> |
369 | <Reference name="System.Data"/> | 369 | <Reference name="System.Data"/> |
370 | <Reference name="OpenSim.Framework"/> | ||
370 | <Reference name="OpenSim.Framework.Data"/> | 371 | <Reference name="OpenSim.Framework.Data"/> |
371 | <Reference name="libsecondlife.dll"/> | 372 | <Reference name="libsecondlife.dll"/> |
372 | <Reference name="Db4objects.Db4o.dll"/> | 373 | <Reference name="Db4objects.Db4o.dll"/> |