From 436ea23e4cd145f901d738340eb39844012b8ee2 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Tue, 8 Feb 2011 05:05:54 +0000 Subject: [PATCH] Instantiate agi::Path, I have no idea if this works on windows since my build is still broken and jfs' code is untested. If someone else doesn't get to it I'll see about fixing my build and making it work. (if it's even broken...) Originally committed to SVN as r5323. --- aegisub/src/main.cpp | 6 ++++++ aegisub/src/main.h | 8 ++++++++ 2 files changed, 14 insertions(+) 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