aboutsummaryrefslogtreecommitdiff
path: root/src/client/mac/crash_generation
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/mac/crash_generation')
-rw-r--r--src/client/mac/crash_generation/Inspector.h15
-rw-r--r--src/client/mac/crash_generation/Inspector.mm28
2 files changed, 29 insertions, 14 deletions
diff --git a/src/client/mac/crash_generation/Inspector.h b/src/client/mac/crash_generation/Inspector.h
index 38d441fb..098c56e8 100644
--- a/src/client/mac/crash_generation/Inspector.h
+++ b/src/client/mac/crash_generation/Inspector.h
@@ -122,18 +122,9 @@ class ConfigFile {
//=============================================================================
class MinidumpLocation {
public:
- MinidumpLocation() {
- NSString *minidumpDirBase = NSHomeDirectory();
- NSString *minidumpDir;
-
- // Put root processes at root
- if (geteuid() == 0)
- minidumpDirBase = @"/";
-
- minidumpDir =
- [minidumpDirBase stringByAppendingPathComponent:@"Library/Logs/Google"];
-
+ MinidumpLocation(const NSString *minidumpDir) {
// Ensure that the path exists. Fallback to /tmp if unable to locate path.
+ assert(minidumpDir);
if (!EnsureDirectoryPathExists(minidumpDir)) {
DEBUGLOG(stderr, "Unable to create: %s\n", [minidumpDir UTF8String]);
minidumpDir = @"/tmp";
@@ -196,5 +187,3 @@ class Inspector {
} // namespace google_breakpad
-
-
diff --git a/src/client/mac/crash_generation/Inspector.mm b/src/client/mac/crash_generation/Inspector.mm
index f659b669..2508289c 100644
--- a/src/client/mac/crash_generation/Inspector.mm
+++ b/src/client/mac/crash_generation/Inspector.mm
@@ -325,7 +325,33 @@ bool Inspector::InspectTask() {
// keep the task quiet while we're looking at it
task_suspend(remote_task_);
- MinidumpLocation minidumpLocation;
+ NSString *minidumpDir;
+
+ const char *minidumpDirectory =
+ config_params_.GetValueForKey(BREAKPAD_DUMP_DIRECTORY);
+
+ // If the client app has not specified a minidump directory,
+ // use a default of Library/<kDefaultLibrarySubdirectory>/<Product Name>
+ if (0 == strlen(minidumpDirectory)) {
+ NSArray *libraryDirectories =
+ NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
+ NSUserDomainMask,
+ YES);
+
+ NSString *applicationSupportDirectory =
+ [libraryDirectories objectAtIndex:0];
+
+ minidumpDir =
+ [NSString stringWithFormat:@"%@/%s/%s",
+ applicationSupportDirectory,
+ kDefaultLibrarySubdirectory,
+ config_params_.GetValueForKey(GOOGLE_BREAKPAD_PRODUCT)];
+ } else {
+ minidumpDir = [[NSString stringWithUTF8String:minidumpDirectory]
+ stringByExpandingTildeInPath];
+ }
+
+ MinidumpLocation minidumpLocation(minidumpDir);
config_file_.WriteFile( &config_params_,
minidumpLocation.GetPath(),