Add a method to determine whether we're in the Apple sandbox
This commit is contained in:
parent
13f9a6c273
commit
e84ae6e2aa
1 changed files with 15 additions and 0 deletions
|
@ -348,6 +348,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) {
|
|||
return (cookie == ReadLink(path));
|
||||
}
|
||||
|
||||
bool IsAppSandboxed() {
|
||||
#if defined(OS_MACOSX)
|
||||
// NB: There is no sane API for this, we have to just guess by
|
||||
// reading tea leaves
|
||||
base::FilePath home_dir;
|
||||
if (!PathService.Get(base::DIR_HOME, &home_dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return home_dir.value().find("Library/Containers") != std::string::npos;
|
||||
#else
|
||||
return false;
|
||||
#endif // defined(OS_MACOSX)
|
||||
}
|
||||
|
||||
bool ConnectSocket(ScopedSocket* socket,
|
||||
const base::FilePath& socket_path,
|
||||
const base::FilePath& cookie_path) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue