Context::Context( const std::string &name ):mName(name),mState( State::create(this) ){ std::string packagePath = "package.path = \'"; std::string stream; stream = "Cinder-Luabind adding lua 'require' paths \n"; for( auto & path : ci::app::getAssetDirectories() ){ stream += path.string() + "\n"; packagePath += path.string()+"/?;"; packagePath += path.string()+"/?.lua;"; } ///need to add this one, how to get the name?? // std::string appResourcePath = ci::app::getAppPath().string() + "/Script.app/Contents/Resources/"; // auto p1 = appResourcePath + "?;"; // auto p2 = appResourcePath + "?.lua;"; packagePath += "\' .. package.path"; runLuaScript(packagePath); CI_LOG_V( stream ); }
rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd, ARGV_const_t prefixes, int warn_only, rpmPlugins plugins) { ARGV_t args = NULL; rpmlogLvl lvl = warn_only ? RPMLOG_WARNING : RPMLOG_ERR; rpmRC rc; int script_type = RPMSCRIPTLET_FORK | RPMSCRIPTLET_EXEC; if (script == NULL) return RPMRC_OK; /* construct a new argv as we can't modify the one from header */ if (script->args) { argvAppend(&args, script->args); } else { argvAdd(&args, "/bin/sh"); } if (rstreq(args[0], "<lua>")) script_type = RPMSCRIPTLET_NONE; /* Run scriptlet pre hook for all plugins */ rc = rpmpluginsCallScriptletPre(plugins, script->descr, script_type); if (rc != RPMRC_FAIL) { if (script_type & RPMSCRIPTLET_EXEC) { rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2); } else { rc = runLuaScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2); } } /* Run scriptlet post hook for all plugins */ rpmpluginsCallScriptletPost(plugins, script->descr, script_type, rc); argvFree(args); return rc; }
void Context::runLuaScript( const ci::DataSourceRef &file ) { runLuaScript( ci::loadString(file) ); }