Shorten Socket path for makeSingleInstance in sandboxed apps #7566

Merged
merged 3 commits into from Oct 17, 2016

Projects

None yet

2 participants

@paulcbetts
Contributor

This PR amends #5236 to work with apps that are sandboxed, non-MAS applications, by detecting dynamically whether we should apply the sandbox workaround instead of restricting it to the MAS build

paulcbetts added some commits Oct 11, 2016
@paulcbetts paulcbetts Add a method to determine whether we're in the Apple sandbox e84ae6e
@paulcbetts paulcbetts Instead of gating the path shortening to MAS_BUILD, figure it out at …
…runtime
06065d1
@paulcbetts paulcbetts Fix oops typos
7dd1ebc
@paulcbetts
Contributor

Verified that this works inside a sandboxed app (which is to say, it doesn't crash)

@@ -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
@zcbenz
zcbenz Oct 12, 2016 Contributor

Maybe just #if defined(MAS_BUILD)?

@paulcbetts
paulcbetts Oct 12, 2016 edited Contributor

That's the whole problem, if you're sandboxed but not using the MAS build (i.e. because you want to sandbox your app but hand it to people via a Zip file), this ifdef is incorrect

@zcbenz
zcbenz Oct 17, 2016 Contributor

That makes sense.

@zcbenz
Contributor
zcbenz commented Oct 17, 2016

👍

@zcbenz zcbenz merged commit cbe9768 into master Oct 17, 2016

6 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
electron-mas-x64 Build #2603 succeeded in 9 min 7 sec
Details
electron-osx-x64 Build #2610 succeeded in 9 min 39 sec
Details
electron-win-ia32 Build #1699 succeeded in 8 min 5 sec
Details
electron-win-x64 Build #1674 succeeded in 8 min 8 sec
Details
@zcbenz zcbenz deleted the always-shorten-path branch Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment