add ability to access logs in getPath()
This commit is contained in:
parent
d9d557dcc5
commit
5ef4caf8ab
5 changed files with 22 additions and 1 deletions
|
@ -375,6 +375,8 @@ int GetPathConstant(const std::string& name) {
|
|||
return brightray::DIR_CACHE;
|
||||
else if (name == "userCache")
|
||||
return brightray::DIR_USER_CACHE;
|
||||
else if (name == "logs")
|
||||
return brightray::DIR_APP_LOGS;
|
||||
else if (name == "home")
|
||||
return base::DIR_HOME;
|
||||
else if (name == "temp")
|
||||
|
|
|
@ -22,6 +22,7 @@ enum {
|
|||
|
||||
DIR_USER_DATA = PATH_START, // Directory where user data can be written.
|
||||
DIR_USER_CACHE, // Directory where user cache can be written.
|
||||
DIR_APP_LOGS, // Directory where app logs live
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
DIR_APP_DATA, // Application Data directory under the user profile.
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
|
||||
namespace brightray {
|
||||
|
||||
void OverrideMacAppLogsPath();
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -160,7 +162,9 @@ void BrowserMainParts::PreEarlyInitialization() {
|
|||
std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
|
||||
feature_list->InitializeFromCommandLine("", "");
|
||||
base::FeatureList::SetInstance(std::move(feature_list));
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
OverrideMacAppLogsPath();
|
||||
#endif
|
||||
#if defined(USE_X11)
|
||||
views::LinuxUI::SetInstance(BuildGtkUi());
|
||||
OverrideLinuxAppDataPath();
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/path_service.h"
|
||||
#include "brightray/browser/brightray_paths.h"
|
||||
#include "content/public/browser/browser_main_parts.h"
|
||||
#include "ui/views/layout/layout_provider.h"
|
||||
|
||||
|
|
|
@ -6,6 +6,18 @@
|
|||
|
||||
namespace brightray {
|
||||
|
||||
void OverrideMacAppLogsPath() {
|
||||
base::FilePath path;
|
||||
NSString* bundleName = [[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey:@"CFBundleName"];
|
||||
NSString* logsPath = [NSString stringWithFormat:@"Library/Logs/%@",bundleName];
|
||||
|
||||
NSString* libraryPath = [NSHomeDirectory() stringByAppendingPathComponent:logsPath];
|
||||
std::string libPathString = std::string([libraryPath UTF8String]);
|
||||
|
||||
PathService::Override(DIR_APP_LOGS, base::FilePath(libPathString));
|
||||
}
|
||||
|
||||
// Replicates NSApplicationMain, but doesn't start a run loop.
|
||||
void BrowserMainParts::InitializeMainNib() {
|
||||
auto infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||
|
|
Loading…
Reference in a new issue