summaryrefslogtreecommitdiffstats
path: root/base/file_util_posix.cc
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 04:15:13 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 04:15:13 +0000
commit151c4a6e282f4282669fb7360dbcbb59c25b92fa (patch)
treeaced67734d49ef99cbe82508f8f6c544a5dd1b3c /base/file_util_posix.cc
parent55397fc328afa661889e11bfac71617667bd3b69 (diff)
downloadchromium_src-151c4a6e282f4282669fb7360dbcbb59c25b92fa.zip
chromium_src-151c4a6e282f4282669fb7360dbcbb59c25b92fa.tar.gz
chromium_src-151c4a6e282f4282669fb7360dbcbb59c25b92fa.tar.bz2
Use the real Mac browser app's bundle identifier everywhere that a base
bundle identifier is needed on the Mac. This means that everything will use up using org.chromium.Chromium, com.google.Chrome, or com.google.Chrome.canary when it's important to get the base bundle identifier. .helper and .framework will not be appended. Note, however, that things that run inside the helper and use CFPreferences or NSUserDefaults will continue to write their defaults as org.chromium.Chromium.helper or com.google.Chrome.helper. Mostly this just affects the Flash plug-in's settings for the NSNav open dialog. There is no com.google.Chrome.canary.helper, but that's not expected to be a problem. This change ensures that Chromes, canaries, and Chromiums don't get in each other's way. BUG=79814 TEST=none Review URL: http://codereview.chromium.org/6896003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 803d610..28d6a61 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -24,6 +24,7 @@
#if defined(OS_MACOSX)
#include <AvailabilityMacros.h>
+#include "base/mac/foundation_util.h"
#else
#include <glib.h>
#endif
@@ -37,6 +38,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
@@ -75,12 +77,17 @@ static int CallStat(const char *path, stat_wrapper_t *sb) {
}
#endif
+static std::string TempFileName() {
+#if defined(OS_MACOSX)
+ return StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID());
+#endif
#if defined(GOOGLE_CHROME_BUILD)
-static const char* kTempFileName = ".com.google.chrome.XXXXXX";
+ return std::string(".com.google.Chrome.XXXXXX");
#else
-static const char* kTempFileName = ".org.chromium.XXXXXX";
+ return std::string(".org.chromium.Chromium.XXXXXX");
#endif
+}
bool AbsolutePath(FilePath* path) {
base::ThreadRestrictions::AssertIOAllowed(); // For realpath().
@@ -402,7 +409,7 @@ bool ReadSymbolicLink(const FilePath& symlink_path,
// This function does NOT unlink() the file.
int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
base::ThreadRestrictions::AssertIOAllowed(); // For call to mkstemp().
- *path = directory.Append(kTempFileName);
+ *path = directory.Append(TempFileName());
const std::string& tmpdir_string = path->value();
// this should be OK since mkstemp just replaces characters in place
char* buffer = const_cast<char*>(tmpdir_string.c_str());
@@ -482,7 +489,7 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix,
if (!GetTempDir(&tmpdir))
return false;
- return CreateTemporaryDirInDirImpl(tmpdir, kTempFileName, new_temp_path);
+ return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path);
}
bool CreateDirectory(const FilePath& full_path) {