From 2353fdb4000606452d2bd149ae03f38108faeebe Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 9 Aug 2017 08:55:46 -0700 Subject: [PATCH] add dir creation if none exists --- brightray/browser/browser_main_parts.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index dc210fca09a0..c7ed4c6752aa 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -4,6 +4,7 @@ #include "brightray/browser/browser_main_parts.h" +#include #include #include "base/command_line.h" @@ -58,6 +59,7 @@ namespace brightray { +// defined in browser_main_parts_mac void OverrideMacAppLogsPath(); namespace { @@ -94,17 +96,20 @@ void OverrideLinuxAppDataPath() { void OverrideWinAppLogsPath() { std::string appName = GetApplicationName(); - std::string logPath = "%systemdrive%%homepath%\AppData\Roaming\\"; + std::string logPath = "%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\\"; std::string appLogPath = logPath + appName + "\logs"; + int status = mkdir(appLogPath, S_IRWXU | S_IRGRP | S_IROTH); + PathService::Override(DIR_APP_LOGS, base::FilePath(appLogPath)); } void OverrideLinuxAppLogsPath() { std::string appName = GetApplicationName(); - std::string logPath = "/var/log/"; + char* homePath = getenv("HOME"); + std::string appLogPath = homePath + "/.config/" + appName; - std::string appLogPath = logPath + appName; + int status = mkdir(appLogPath, S_IRWXU | S_IRGRP | S_IROTH); PathService::Override(DIR_APP_LOGS, base::FilePath(appLogPath)); } @@ -130,7 +135,7 @@ int BrowserX11IOErrorHandler(Display* d) { // Wait for the UI thread (which has a different connection to the X server) // to get the error. We can't call shutdown from this thread without // tripping an error. Doing it through a function so that we'll be able - // to see it in any crash dumps. + // to see it in any crash dumps.back WaitingForUIThreadToHandleIOError(); return 0; }