|
From: <sgv...@us...> - 2012-02-14 15:48:12
|
Revision: 291
http://simspark.svn.sourceforge.net/simspark/?rev=291&view=rev
Author: sgvandijk
Date: 2012-02-14 15:48:05 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
- add --init-script-prefix option to specify location of spark.rb, zeitgeist.rb, etc
Modified Paths:
--------------
trunk/spark/ChangeLog
trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp
trunk/spark/spark/spark.cpp
trunk/spark/spark/spark.h
Modified: trunk/spark/ChangeLog
===================================================================
--- trunk/spark/ChangeLog 2012-01-25 18:04:21 UTC (rev 290)
+++ trunk/spark/ChangeLog 2012-02-14 15:48:05 UTC (rev 291)
@@ -1,3 +1,10 @@
+2012-02-14 Sander van Dijk <sgv...@gm...>
+
+ * lib/zeitgeist/scriptserver/scriptserver.cpp (RunInitScript):
+ * spark/spark.h (Spark):
+ * spark/spark.cpp (Spark):
+ - add --init-script-prefix option to specify location of spark.rb, zeitgeist.rb, etc
+
2012-01-22 Hedayat Vatankhah <hed...@gm...>
* lib/kerosin/renderserver/rendercontrol.cpp (RenderControl::EndCycle):
Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp
===================================================================
--- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2012-01-25 18:04:21 UTC (rev 290)
+++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2012-02-14 15:48:05 UTC (rev 291)
@@ -614,6 +614,23 @@
ERunScriptErrorType result = eNotFound;
+ // Trying directory given in mRelPathPrefix
+ result = RunInitScriptInternal(mRelPathPrefix, fileName, validDotDir, dotDir);
+ if (result == eOK)
+ {
+ GetLog()->Debug() << "(ScriptServer) : Ran init script '"
+ << mRelPathPrefix << salt::RFile::Sep() << fileName << "'\n";
+ return true;
+ }
+ else if (result == eError)
+ {
+ GetLog()->Error() << "(ScriptServer) ERROR: Found error in init script '"
+ << mRelPathPrefix << salt::RFile::Sep() << fileName << "'\n";
+ return false;
+ }
+
+
+
if (validDotDir)
{
// Trying dot-dir in home directory
Modified: trunk/spark/spark/spark.cpp
===================================================================
--- trunk/spark/spark/spark.cpp 2012-01-25 18:04:21 UTC (rev 290)
+++ trunk/spark/spark/spark.cpp 2012-02-14 15:48:05 UTC (rev 291)
@@ -38,12 +38,7 @@
using namespace std;
using namespace boost;
-Spark::Spark(const string& relPathPrefix) :
- mZeitgeist(new Zeitgeist("." PACKAGE_NAME, relPathPrefix)),
- mOxygen(new Oxygen(*mZeitgeist))
-#if HAVE_KEROSIN_KEROSIN_H
- , mKerosin(new Kerosin(*mZeitgeist))
-#endif
+Spark::Spark()
{
}
@@ -104,12 +99,28 @@
bool
Spark::Init(int argc, char** argv)
{
+ // See if user gave path prefix for init scripts
+ string relPathPrefix = "../..";
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "--init-script-prefix") == 0)
+ {
+ relPathPrefix = argv[i + 1];
+ }
+ }
+
+ mZeitgeist = shared_ptr<Zeitgeist>(new Zeitgeist("." PACKAGE_NAME, relPathPrefix));
+ mOxygen = shared_ptr<Oxygen>(new Oxygen(*mZeitgeist));
+#if HAVE_KEROSIN_KEROSIN_H
+ mKerosin = shared_ptr<Kerosin>(new Kerosin(*mZeitgeist));
+#endif
+
// run the spark init script
mZeitgeist->GetCore()->GetScriptServer()->RunInitScript
(
"spark.rb",
"lib/spark",
- ScriptServer::IS_USERLOCAL
+ ScriptServer::IS_COMMON
);
UpdateCached();
Modified: trunk/spark/spark/spark.h
===================================================================
--- trunk/spark/spark/spark.h 2012-01-25 18:04:21 UTC (rev 290)
+++ trunk/spark/spark/spark.h 2012-02-14 15:48:05 UTC (rev 291)
@@ -72,7 +72,7 @@
class SPARK_API Spark
{
public:
- Spark(const std::string& relPathPrefix);
+ Spark();
virtual ~Spark();
/** inits the Spark lib, returns true on success, has to be called once
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|