Instead of gating the path shortening to MAS_BUILD, figure it out at runtime

This commit is contained in:
Paul Betts 2016-10-11 13:01:20 -07:00
parent e84ae6e2aa
commit 06065d1c5d

View file

@ -961,8 +961,8 @@ bool ProcessSingleton::Create() {
#endif #endif
} }
#if defined(MAS_BUILD) if (IsAppSandboxed()) {
// For Mac App Store build, the tmp dir could be too long to fit // For sandboxed applications, the tmp dir could be too long to fit
// addr->sun_path, so we need to make it as short as possible. // addr->sun_path, so we need to make it as short as possible.
base::FilePath tmp_dir; base::FilePath tmp_dir;
if (!base::GetTempDir(&tmp_dir)) { if (!base::GetTempDir(&tmp_dir)) {
@ -973,7 +973,7 @@ bool ProcessSingleton::Create() {
LOG(ERROR) << "Failed to set socket directory."; LOG(ERROR) << "Failed to set socket directory.";
return false; return false;
} }
#else } else {
// Create the socket file somewhere in /tmp which is usually mounted as a // Create the socket file somewhere in /tmp which is usually mounted as a
// normal filesystem. Some network filesystems (notably AFS) are screwy and // normal filesystem. Some network filesystems (notably AFS) are screwy and
// do not support Unix domain sockets. // do not support Unix domain sockets.
@ -981,7 +981,7 @@ bool ProcessSingleton::Create() {
LOG(ERROR) << "Failed to create socket directory."; LOG(ERROR) << "Failed to create socket directory.";
return false; return false;
} }
#endif }
// Check that the directory was created with the correct permissions. // Check that the directory was created with the correct permissions.
int dir_mode = 0; int dir_mode = 0;