/// <summary> /// Gets the full path to the command scripts folder. /// </summary> /// <returns>the full path to the folder</returns> private static string GetScriptFolder() { string scriptFolder = WCellDef.GetFullPath(WCellDef.SCRIPT_DIR, WCellDef.CMD_SCRIPT_DIR); DirectoryInfo scriptFolderInfo = new DirectoryInfo(scriptFolder); if (!scriptFolderInfo.Exists) { scriptFolderInfo.Create(); } return(scriptFolder); }
/// <summary> /// Initializes the script environment by executing a command-specific file /// that contains special functions needed by scripts. /// </summary> /// <returns>true if the script was excuted; false otherwise</returns> private bool InitializeEnvironment() { // call our set-up script that loads our auxiliary command functions if (!m_scriptEnv.LoadResource(WCellDef.GetFullPath(WCellDef.SCRIPT_DIR, CMDMGR_SCRIPT_NAME), LoadStrategy.File, true)) { Logger.Error(string.Format(Resources.ScriptLoadFailed, CMDMGR_SCRIPT_NAME)); return(false); } // set the privilege manager so commands can register themselves m_scriptEnv.ExecuteFunction("global", "setPrivilegeManager", PrivilegeMgr.Instance); return(true); }