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.
This commit is contained in:
Amar Takhar 2011-02-08 05:05:54 +00:00
parent 355ad91105
commit 436ea23e4c
2 changed files with 14 additions and 0 deletions

View file

@ -89,6 +89,7 @@
namespace config { namespace config {
agi::Options *opt; agi::Options *opt;
agi::MRUManager *mru; agi::MRUManager *mru;
agi::Path *path;
} }
@ -181,6 +182,10 @@ bool AegisubApp::OnInit() {
emit_stdout->Enable(); emit_stdout->Enable();
#endif #endif
std::string path(agi::Path::Config());
config::path = new agi::Path(path.append("path.json"), GET_DEFAULT_CONFIG(default_path));
// Init command manager // Init command manager
cmd::cm = new cmd::CommandManager(); cmd::cm = new cmd::CommandManager();
@ -335,6 +340,7 @@ int AegisubApp::OnExit() {
delete config::opt; delete config::opt;
delete config::mru; delete config::mru;
delete agi::hotkey::hotkey; delete agi::hotkey::hotkey;
delete config::path;
#ifdef WITH_AUTOMATION #ifdef WITH_AUTOMATION
delete global_scripts; delete global_scripts;

View file

@ -46,6 +46,7 @@
#include "aegisublocale.h" #include "aegisublocale.h"
#include <libaegisub/mru.h> #include <libaegisub/mru.h>
#include <libaegisub/option.h> #include <libaegisub/option.h>
#include <libaegisub/path.h>
////////////// //////////////
// Prototypes // Prototypes
@ -63,6 +64,7 @@ namespace agi {
namespace config { namespace config {
extern agi::Options *opt; ///< Options extern agi::Options *opt; ///< Options
extern agi::MRUManager *mru; ///< Most Recently Used extern agi::MRUManager *mru; ///< Most Recently Used
extern agi::Path *path; ///< Paths
} }
/// DOCME /// DOCME
@ -80,6 +82,12 @@ namespace Automation4 { class AutoloadScriptManager; }
/// Macro to unsubscribe to OptionValue changes /// Macro to unsubscribe to OptionValue changes
#define OPT_UNSUB(x, ...) config::opt->Get(x)->Unsubscribe(__VA_ARGS__) #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 /// DOCME
/// @class AegisubApp /// @class AegisubApp