From 09531a03055f0f053bf55d860137c54c7f3a09b3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 5 Nov 2016 18:24:40 +1000 Subject: More config path fixes. --- .../LoadRegions/RegionLoaderFileSystem.cs | 45 +++++++++++++--------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'OpenSim/ApplicationPlugins') diff --git a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 1873a06..130a523 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -38,7 +38,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public class RegionLoaderFileSystem : IRegionLoader { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private IConfigSource m_configSource; public void SetIniConfigSource(IConfigSource configSource) @@ -48,7 +48,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public RegionInfo[] LoadRegions() { - string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); + string regionConfigPath = Util.configDir(); bool allowRegionless = false; try @@ -68,47 +68,54 @@ namespace OpenSim.ApplicationPlugins.LoadRegions } string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); - string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); +//// Causes hangs with the actual .ini files. +//// string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); // Create an empty Regions.ini if there are no existing config files. - if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0) - { + if (!allowRegionless && configFiles.Length == 0 /*&& iniFiles.Length == 0*/) + { new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource); - iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); +//// iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); } - + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath); List regionInfos = new List(); int i = 0; +/* foreach (string file in iniFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); - + IConfigSource source = new IniConfigSource(file); foreach (IConfig config in source.Configs) - { + { RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); regionInfos.Add(regionInfo); - + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); - + i++; } } - +*/ foreach (string file in configFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); - - RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); - regionInfos.Add(regionInfo); - - m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); - - i++; + + IConfigSource source = new XmlConfigSource(file); + + foreach (IConfig config in source.Configs) + { + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); + regionInfos.Add(regionInfo); + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); + + i++; + } } return regionInfos.ToArray(); -- cgit v1.1