add first go at linux log path override

This commit is contained in:
Shelley Vohr 2017-08-07 13:22:10 -07:00 committed by Shelley Vohr
parent 5ef4caf8ab
commit f026bbb454
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -89,6 +89,18 @@ void OverrideLinuxAppDataPath() {
PathService::Override(DIR_APP_DATA, path); PathService::Override(DIR_APP_DATA, path);
} }
// void OverrideWinAppLogsPath() {
// base::FilePath path;
// // should be in c:\program files\myapp\logs ?
// PathService::Override(DIR_APP_DATA, path);
// }
void OverrideLinuxAppLogsPath() {
std::string appName = GetExecutableFileProductName();
std::string logPath = '/var/log' + appName
PathService::Override(DIR_APP_DATA, base::FilePath(logPath));
}
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) { int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
if (!g_in_x11_io_error_handler) { if (!g_in_x11_io_error_handler) {
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
@ -165,6 +177,12 @@ void BrowserMainParts::PreEarlyInitialization() {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
OverrideMacAppLogsPath(); OverrideMacAppLogsPath();
#endif #endif
#if defined(OS_LINUX)
OverrideLinuxAppLogsPath();
#endif
// #if defined(OS_WIN)
// OverrideWinAppLogsPath();
// #endif
#if defined(USE_X11) #if defined(USE_X11)
views::LinuxUI::SetInstance(BuildGtkUi()); views::LinuxUI::SetInstance(BuildGtkUi());
OverrideLinuxAppDataPath(); OverrideLinuxAppDataPath();