* 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.
This commit is contained in:
Amar Takhar 2011-01-08 19:14:02 +00:00
parent 3f110101aa
commit 93f8b84688
3 changed files with 15 additions and 23 deletions

View File

@ -33,6 +33,7 @@ SRC = \
progress.cpp \
report.cpp \
upload.cpp \
util.cpp \
view.cpp

View File

@ -19,12 +19,10 @@
/// @ingroup base
#ifndef R_PRECOMP
#include <wx/wfstream.h>
#include <wx/stdpaths.h>
#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);
}

View File

@ -22,25 +22,28 @@
#include <locale.h>
#include <wx/app.h>
#include <wx/window.h>
#include <wx/log.h>
#include <wx/button.h>
#include <wx/cmdline.h>
#include <wx/wxchar.h>
#include <wx/filename.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/panel.h>
#include <wx/font.h>
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/intl.h>
#include <wx/window.h>
#endif
#include <libaegisub/log.h>
#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;