I've posted 2 replies and both haven't been posted to this thread.
Weird. I see no sign of these from my side [1] but I’ll check internally.
my question is how would I know if this Electron app is sandboxed?
In Electron, I’ve no idea. In a standard Xcode project you can check for the App Sandbox capability in the Signing & Capabilities tab. Alternatively, you can dump the entitlements of the built app:
% codesign -d --entitlements - /Applications/PCalc.app | grep -A 1 "com.apple.security.app-sandbox"
Executable=/Applications/PCalc.app/Contents/MacOS/PCalc
[Key] com.apple.security.app-sandbox
[Value]
% codesign -d --entitlements - /Applications/VMware\ Fusion.app | grep -A 1 "com.apple.security.app-sandbox"
Executable=/Applications/VMware Fusion.app/Contents/MacOS/VMware Fusion
%
what would be the remedy if it is or isn't...?
In both case a program should locate the correct place for its log files using FileManager
. For example:
let log = try FileManager.default.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
.appending(path: "Logs", directoryHint: .isDirectory)
.appending(path: "MyApp.log", directoryHint: .notDirectory)
If the app is not sandboxed, that’ll end up it ~/Library/Logs/MyApp.log
. If the app is sandboxed, it’ll be at Library/Logs/MyApp.log
relative to the root of the app’s container.
Having said that, logging to text files is not something I recommend. Rather, I encourage folks to log to the system log. See Your Friend the System Log for more on that.
The file is created inside the same folder where my child process is
located.
That’s definitely not going to work. Your app’s bundle is effectively read-only [2] so, if this tool is embedded within your app, it won’t be able to create log files in the same directory as the tool.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Normally when the moderators get… *cough*… over enthusiastic I’m able to at least see the deleted posts.
[2] See the Separate read-only and read/write content section of Embedding nonstandard code structures in a bundle.