private void AddIncludes(OpenSimConfigSource configSource, List<string> sources)
{
//loop over config sources
foreach (IConfig config in configSource.Source.Configs)
{
// Look for Include-* in the key name
string[] keys = config.GetKeys();
foreach (string k in keys)
{
if (k.StartsWith("Include-"))
{
// read the config file to be included.
string file = config.GetString(k);
if (IsUri(file))
{
if (!sources.Contains(file))
sources.Add(file);
}
else
{
string basepath = Path.GetFullPath(Util.configDir());
// 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);
// If the include path contains no wildcards, then warn the user that it wasn't found.
if (wildcardIndex == -1 && paths.Length == 0)
{
m_log.WarnFormat("[CONFIG]: Could not find include file {0}", path);
}
else
{
foreach (string p in paths)
{
if (!sources.Contains(p))
sources.Add(p);
}
}
}
}
}
}
}
/// <summary>