*Added -useexecutepath to use the path of the .exe as the path to find configuration and libraries and not the current working directory.

afrisby
mingchen 2007-10-19 19:20:18 +00:00
parent 9853db1708
commit f756b1ee1c
3 changed files with 33 additions and 0 deletions

View File

@ -44,6 +44,8 @@ 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)
{ {
return Helpers.UIntsToLong(X, Y); return Helpers.UIntsToLong(X, Y);
@ -295,12 +297,22 @@ 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;
} }
@ -308,6 +320,10 @@ 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;
} }
@ -315,6 +331,10 @@ 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;
} }
@ -322,6 +342,10 @@ 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

@ -65,6 +65,7 @@ namespace OpenSim
configSource.AddSwitch("Startup", "gridmode"); configSource.AddSwitch("Startup", "gridmode");
configSource.AddSwitch("Startup", "physics"); configSource.AddSwitch("Startup", "physics");
configSource.AddSwitch("Startup", "noverbose"); configSource.AddSwitch("Startup", "noverbose");
configSource.AddSwitch("Startup", "useexecutepath");
OpenSimMain sim = new OpenSimMain(configSource); OpenSimMain sim = new OpenSimMain(configSource);

View File

@ -91,6 +91,14 @@ namespace OpenSim
{ {
IConfigSource startupSource = configSource; IConfigSource startupSource = configSource;
string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini"); string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
string useExecutePathString = startupSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
bool useExecutePath = false;
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
{
useExecutePath = true;
}
Util.changeUseExecutePathSetting(useExecutePath);
//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); string iniFilePath = Path.Combine(Util.configDir(), iniFile);