Small bit of refactoring to the startup command script code (moved it into a separate method), so that I could add a new CLI command of "command-script <fileName>", so that as well as the startup command script still being processed on startup. A user can create other command scripts and use the single command ("command-script <filename>") to run them at any time. Could be useful for trying out various configurations etc.
parent
487a54ffc0
commit
4276a352bc
|
@ -205,10 +205,20 @@ namespace OpenSim
|
|||
//Run Startup Commands
|
||||
if (m_startupCommandsFile != "")
|
||||
{
|
||||
MainLog.Instance.Verbose("Running startup command script (" + m_startupCommandsFile + ")");
|
||||
if (File.Exists(m_startupCommandsFile))
|
||||
RunCommandScript(m_startupCommandsFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamReader readFile = File.OpenText(m_startupCommandsFile);
|
||||
MainLog.Instance.Verbose("No startup command script specified. Moving on...");
|
||||
}
|
||||
}
|
||||
|
||||
private void RunCommandScript(string fileName)
|
||||
{
|
||||
MainLog.Instance.Verbose("Running command script (" + fileName + ")");
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
StreamReader readFile = File.OpenText(fileName);
|
||||
string currentCommand = "";
|
||||
while ((currentCommand = readFile.ReadLine()) != null)
|
||||
{
|
||||
|
@ -221,12 +231,7 @@ namespace OpenSim
|
|||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Error("Startup command script missing. Will not run startup commands");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Verbose("No startup command script specified. Moving on...");
|
||||
MainLog.Instance.Error("Command script missing. Can not run commands");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,6 +408,13 @@ namespace OpenSim
|
|||
}
|
||||
break;
|
||||
|
||||
case "command-script":
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
RunCommandScript(cmdparams[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case "permissions":
|
||||
// Treats each user as a super-admin when disabled
|
||||
foreach (Scene scene in m_localScenes)
|
||||
|
|
|
@ -207,8 +207,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
|
||||
if (x > 63 || y > 63 || x < 0 || y < 0)
|
||||
{
|
||||
return null;
|
||||
//throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -221,8 +220,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
{
|
||||
if (x > 256 || y > 256 || x < 0 || y < 0)
|
||||
{
|
||||
return null;
|
||||
//throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue