void ScriptEngine::armScriptEngine(QScriptEngine *engine) { QScriptEngine &myengine = *engine; myclient->registerMetaTypes(&myengine); QScriptValue sys = myengine.newQObject(this); myengine.globalObject().setProperty("sys", sys); myengine.globalObject().setProperty("client", myengine.newQObject(dynamic_cast<QObject*>(myclient))); sys.setProperty("scriptsFolder", appDataPath("Scripts/", true)); sys.setProperty("eval", myengine.newFunction(&eval)); QScriptValue printfun = myengine.newFunction(nativePrint); printfun.setData(sys); myengine.globalObject().setProperty("print", printfun); QScriptValue channelfun = myengine.newFunction(channelNames); channelfun.setData(sys.property("client")); myengine.globalObject().property("client").setProperty("channelNames", channelfun); }
ScriptEngine::ScriptEngine(ClientInterface *c) { myclient = c; armScriptEngine(&myengine); connect(&manager, SIGNAL(finished(QNetworkReply*)), SLOT(webCall_replyFinished(QNetworkReply*))); changeScript(ScriptUtils::loadScripts()); changeBattleScript(ScriptUtils::loadScripts(ScriptUtils::BattleScripts)); QTimer *step_timer = new QTimer(this); step_timer->setSingleShot(false); step_timer->start(1000); connect(step_timer, SIGNAL(timeout()), SLOT(timer_step())); QSettings s; safeScripts = s.value("ScriptWindow/safeScripts", true).toBool(); warnings = s.value("ScriptWindow/warn", true).toBool(); datalocation = appDataPath("Scripts/", true) + "/data.ini"; }
void WinConsole::SetupConfigFile() { // create new config-file from config template char commonAppDataPath[MAX_PATH]; SHGetFolderPath(nullptr, CSIDL_COMMON_APPDATA, nullptr, 0, commonAppDataPath); BString<1024> filename("%s\\NZBGet\\nzbget.conf", commonAppDataPath); BString<1024> appDataPath("%s\\NZBGet", commonAppDataPath); FileSystem::CreateDirectory(appDataPath); BString<1024> confTemplateFilename("%s\\nzbget.conf.template", g_Options->GetAppDir()); CopyFile(confTemplateFilename, filename, FALSE); // set MainDir in the config-file int size = 0; CharBuffer config; if (FileSystem::LoadFileIntoBuffer(filename, config, true)) { const char* SIGNATURE = "MainDir=${AppDir}\\downloads"; char* p = strstr(config, SIGNATURE); if (p) { DiskFile outfile; if (outfile.Open(filename, DiskFile::omWrite)) { outfile.Write(config, p - config); outfile.Write("MainDir=", 8); outfile.Write(appDataPath, strlen(appDataPath)); outfile.Write(p + strlen(SIGNATURE), config.Size() - 1 - (p + strlen(SIGNATURE) - config) - 1); outfile.Close(); } } } // create default destination directory (which is not created on start automatically) BString<1024> completeDir("%s\\NZBGet\\complete", commonAppDataPath); FileSystem::CreateDirectory(completeDir); }
QString Notepadqq::extensionToolsPath() { return appDataPath("extension_tools"); }
QString Notepadqq::editorPath() { return appDataPath("editor/index.html"); }
// OS specific paths. QString PokemonBox::getBoxPath() { QString boxpath = appDataPath("Boxes", true); return boxpath; }