c# - Unauthorized Access to file on Desktop in Avalonia app on macOS - Stack Overflow

We've got a macOS Avalonia problem when trying to package multiple builds for different cpu archit

We've got a macOS Avalonia problem when trying to package multiple builds for different cpu architectures in the same macOS .app bundle.

We are attempting to place the entire x64 and arm64 build folders inside the MacOS folder in the bundle and then use a script as a stand-in for the actual executable to detect the architecture and launch the actual, cpu-specific executable in the appropriate subfolder.

When launched directly from the terminal -- /path/to/Switcheroo/Publish/Switcheroo.app/Contents/MacOS/Switcheroo -- it runs fine.

It displays 2 things: the architecture and a message from a file on your desktop called switcheroo-message.txt.

Same thing for skipping the script entirely...

/path/to/Switcheroo/Publish/Switcheroo.app/Contents/MacOS/arm64/Switcheroo /path/to/Switcheroo/Publish/Switcheroo.app/Contents/MacOS/x64/Switcheroo

However, when double-clicked in the finder, an exception is thrown when the app tries to read that file.

I catch the exception and show only its name in the app window, but this is the full message:

"System.UnauthorizedAccessException: Access to the path '/Users/myuser/Desktop/switcheroo-message.txt' is denied"

Here is the test project. Hopefully someone in here has run into this before:

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744138328a4560163.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信