diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index dbbf65904..c1acdd51e 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -89,6 +89,7 @@ namespace config { agi::Options *opt; agi::MRUManager *mru; + agi::Path *path; } @@ -181,6 +182,10 @@ bool AegisubApp::OnInit() { emit_stdout->Enable(); #endif + std::string path(agi::Path::Config()); + config::path = new agi::Path(path.append("path.json"), GET_DEFAULT_CONFIG(default_path)); + + // Init command manager cmd::cm = new cmd::CommandManager(); @@ -335,6 +340,7 @@ int AegisubApp::OnExit() { delete config::opt; delete config::mru; delete agi::hotkey::hotkey; + delete config::path; #ifdef WITH_AUTOMATION delete global_scripts; diff --git a/aegisub/src/main.h b/aegisub/src/main.h index 279129eaa..e4e243f8a 100644 --- a/aegisub/src/main.h +++ b/aegisub/src/main.h @@ -46,6 +46,7 @@ #include "aegisublocale.h" #include #include +#include ////////////// // Prototypes @@ -63,6 +64,7 @@ namespace agi { namespace config { extern agi::Options *opt; ///< Options extern agi::MRUManager *mru; ///< Most Recently Used + extern agi::Path *path; ///< Paths } /// DOCME @@ -80,6 +82,12 @@ namespace Automation4 { class AutoloadScriptManager; } /// Macro to unsubscribe to OptionValue changes #define OPT_UNSUB(x, ...) config::opt->Get(x)->Unsubscribe(__VA_ARGS__) +/// Macro to get a path. +#define PATH_GET(x) AegisubApp::Get()->path->Get(x) + +/// Macro to set a path. +#define PATH_SET(x, y) AegisubApp::Get()->path->Set(x, y) + /// DOCME /// @class AegisubApp