From 21bc238029aed6d80f0f3bf4233f7d68387e9a88 Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 10 Aug 2010 16:07:21 +0200 Subject: Configuration files can read include files from relative paths. --- OpenSim/Region/Application/ConfigurationLoader.cs | 12 +++++++++++- OpenSim/Tools/Configger/ConfigurationLoader.cs | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 09f7bea..e69e3fc 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -211,7 +211,17 @@ namespace OpenSim else { string basepath = Path.GetFullPath(Util.configDir()); - string path = Path.Combine(basepath, file); + // Resolve relative paths with wildcards + string chunkWithoutWildcards = file; + string chunkWithWildcards = string.Empty; + int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' }); + if (wildcardIndex != -1) + { + chunkWithoutWildcards = file.Substring(0, wildcardIndex); + chunkWithWildcards = file.Substring(wildcardIndex); + } + string path = Path.Combine(basepath, chunkWithoutWildcards); + path = Path.GetFullPath(path) + chunkWithWildcards; string[] paths = Util.Glob(path); foreach (string p in paths) { diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index e74debb..8e71b42 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs @@ -141,7 +141,17 @@ namespace OpenSim.Tools.Configger else { string basepath = Path.GetFullPath("."); - string path = Path.Combine(basepath, file); + // Resolve relative paths with wildcards + string chunkWithoutWildcards = file; + string chunkWithWildcards = string.Empty; + int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' }); + if (wildcardIndex != -1) + { + chunkWithoutWildcards = file.Substring(0, wildcardIndex); + chunkWithWildcards = file.Substring(wildcardIndex); + } + string path = Path.Combine(basepath, chunkWithoutWildcards); + path = Path.GetFullPath(path) + chunkWithWildcards; string[] paths = Util.Glob(path); foreach (string p in paths) { -- cgit v1.1