add dir creation if none exists
This commit is contained in:
parent
e81cf74b39
commit
2353fdb400
1 changed files with 9 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "brightray/browser/browser_main_parts.h"
|
#include "brightray/browser/browser_main_parts.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
// defined in browser_main_parts_mac
|
||||||
void OverrideMacAppLogsPath();
|
void OverrideMacAppLogsPath();
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -94,17 +96,20 @@ void OverrideLinuxAppDataPath() {
|
||||||
|
|
||||||
void OverrideWinAppLogsPath() {
|
void OverrideWinAppLogsPath() {
|
||||||
std::string appName = GetApplicationName();
|
std::string appName = GetApplicationName();
|
||||||
std::string logPath = "%systemdrive%%homepath%\AppData\Roaming\\";
|
std::string logPath = "%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\\";
|
||||||
std::string appLogPath = logPath + appName + "\logs";
|
std::string appLogPath = logPath + appName + "\logs";
|
||||||
|
|
||||||
|
int status = mkdir(appLogPath, S_IRWXU | S_IRGRP | S_IROTH);
|
||||||
|
|
||||||
PathService::Override(DIR_APP_LOGS, base::FilePath(appLogPath));
|
PathService::Override(DIR_APP_LOGS, base::FilePath(appLogPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverrideLinuxAppLogsPath() {
|
void OverrideLinuxAppLogsPath() {
|
||||||
std::string appName = GetApplicationName();
|
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));
|
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)
|
// 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
|
// 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
|
// 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();
|
WaitingForUIThreadToHandleIOError();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue