Configuration files can read include files from relative paths.

0.7.0.2-release
Marck 2010-08-10 16:07:21 +02:00 committed by Diva Canto
parent 6acfa136a4
commit 21bc238029
2 changed files with 22 additions and 2 deletions

View File

@ -211,7 +211,17 @@ namespace OpenSim
else else
{ {
string basepath = Path.GetFullPath(Util.configDir()); 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); string[] paths = Util.Glob(path);
foreach (string p in paths) foreach (string p in paths)
{ {

View File

@ -141,7 +141,17 @@ namespace OpenSim.Tools.Configger
else else
{ {
string basepath = Path.GetFullPath("."); 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); string[] paths = Util.Glob(path);
foreach (string p in paths) foreach (string p in paths)
{ {