*Replaced -useexecutepath with an updated -inifile extension. You can now specify either a filename (will use the default config path, or you can specify a full path.

afrisby
mingchen 2007-10-28 03:41:34 +00:00
parent fb6aa6eafc
commit d56da1c831
2 changed files with 15 additions and 37 deletions

View File

@ -44,7 +44,6 @@ namespace OpenSim.Framework.Utilities
private static object XferLock = new object(); private static object XferLock = new object();
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
private static bool m_useExecutePath;
public static ulong UIntsToLong(uint X, uint Y) public static ulong UIntsToLong(uint X, uint Y)
{ {
@ -298,21 +297,12 @@ namespace OpenSim.Framework.Utilities
// directory locations // directory locations
// //
public static void changeUseExecutePathSetting(bool setting)
{
m_useExecutePath = setting;
}
public static string homeDir() public static string homeDir()
{ {
string temp; string temp;
// string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); // string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
// temp = Path.Combine(personal,".OpenSim"); // temp = Path.Combine(personal,".OpenSim");
temp="."; temp=".";
if (m_useExecutePath)
{
temp = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
return temp; return temp;
} }
@ -320,10 +310,6 @@ namespace OpenSim.Framework.Utilities
{ {
string temp; string temp;
temp = "."; temp = ".";
if (m_useExecutePath)
{
temp = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
return temp; return temp;
} }
@ -331,10 +317,6 @@ namespace OpenSim.Framework.Utilities
{ {
string temp; string temp;
temp = "."; temp = ".";
if (m_useExecutePath)
{
temp = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
return temp; return temp;
} }
@ -342,10 +324,6 @@ namespace OpenSim.Framework.Utilities
{ {
string temp; string temp;
temp = "."; temp = ".";
if (m_useExecutePath)
{
temp = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
return temp; return temp;
} }

View File

@ -95,20 +95,10 @@ namespace OpenSim
{ {
IConfig startupConfig = configSource.Configs["Startup"]; IConfig startupConfig = configSource.Configs["Startup"];
string iniFile = startupConfig.GetString("inifile", "OpenSim.ini"); string iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
string useExecutePathString = startupConfig.GetString("useexecutepath", "false").ToLower();
bool useExecutePath = false;
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
{
useExecutePath = true;
}
Util.changeUseExecutePathSetting(useExecutePath);
m_config = new IniConfigSource(); m_config = new IniConfigSource();
//check for .INI file (either default or name passed in command line) //check for .INI file (either default or name passed in command line)
string iniFilePath = Path.Combine(Util.configDir(), iniFile);
if (File.Exists(iniFilePath)) if (File.Exists(iniFilePath))
{ {
m_config.Merge(new IniConfigSource(iniFilePath)); m_config.Merge(new IniConfigSource(iniFilePath));
@ -116,12 +106,22 @@ namespace OpenSim
} }
else else
{ {
// no default config files, so set default values, and save it iniFilePath = Path.Combine(Util.configDir(), iniFilePath);
SetDefaultConfig(); if (File.Exists(iniFilePath))
{
m_config.Merge(new IniConfigSource(iniFilePath));
m_config.Merge(configSource);
}
else
{
m_config.Merge(configSource); // no default config files, so set default values, and save it
SetDefaultConfig();
m_config.Save(iniFilePath); m_config.Merge(configSource);
m_config.Save(iniFilePath);
}
} }
ReadConfigSettings(); ReadConfigSettings();