From 93f8b84688f86efc5b0c3c1819cdfe9c3d99362d Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Sat, 8 Jan 2011 19:14:02 +0000 Subject: [PATCH] * Instantiate log class. * Create new util file and add a config_path() function to get Aegisubs' configuration directory. * Header cleanu Originally committed to SVN as r5146. --- aegisub/reporter/Makefile | 1 + aegisub/reporter/aegisub.cpp | 16 ++-------------- aegisub/reporter/main.cpp | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/aegisub/reporter/Makefile b/aegisub/reporter/Makefile index cc30f3f51..01f319a28 100644 --- a/aegisub/reporter/Makefile +++ b/aegisub/reporter/Makefile @@ -33,6 +33,7 @@ SRC = \ progress.cpp \ report.cpp \ upload.cpp \ + util.cpp \ view.cpp diff --git a/aegisub/reporter/aegisub.cpp b/aegisub/reporter/aegisub.cpp index 2603832f2..e1511bba1 100644 --- a/aegisub/reporter/aegisub.cpp +++ b/aegisub/reporter/aegisub.cpp @@ -19,12 +19,10 @@ /// @ingroup base #ifndef R_PRECOMP -#include -#include #endif #include "aegisub.h" - +#include "util.h" #ifdef __WINDOWS__ #include "../src/config.h" @@ -33,18 +31,8 @@ #endif Aegisub::Aegisub() { - wxStandardPathsBase &paths = wxStandardPaths::Get(); -// Using ifdefs is a pain but it's much easier to centralise this. -#if defined(__APPLE__) - std::string conf_user(wxString::Format("%s-%s/config.json", paths.GetUserDataDir(), _T(AEGISUB_VERSION_DATA))); -#elif defined(__UNIX__) - std::string conf_user(wxString::Format("%s/.aegisub-%s/config.json", paths.GetUserConfigDir(), _T(AEGISUB_VERSION_DATA))); -#else - std::string conf_user(wxString::Format("%s/Aegisub/config.json", paths.GetUserConfigDir())); -#endif - std::string default_config("{}"); - opt = new agi::Options(conf_user, default_config, agi::Options::FLUSH_SKIP); + opt = new agi::Options(config_path() + "config.json", default_config, agi::Options::FLUSH_SKIP); } diff --git a/aegisub/reporter/main.cpp b/aegisub/reporter/main.cpp index 374619d9d..b514cdd60 100644 --- a/aegisub/reporter/main.cpp +++ b/aegisub/reporter/main.cpp @@ -22,25 +22,28 @@ #include #include -#include -#include +#include #include -#include +#include +#include #include #include -#include -#include -#include #include -#include +#include #endif +#include + #include "main.h" #include "upload.h" +#include "util.h" /// @brief Init the reporter. -bool Reporter::OnInit() -{ +bool Reporter::OnInit() { + + const std::string path_log(config_path() + "log/"); + wxFileName::Mkdir(path_log, 0777, wxPATH_MKDIR_FULL); + agi::log::log = new agi::log::LogSink(path_log); // if ( !wxApp::OnInit() ) // return false;