citymania-org / cmclient

CityMania OpenTTD patched client
Other
22 stars 8 forks source link

OpenTTD asks for permission to access documents folder with every launch #6

Open danidoedel opened 3 years ago

danidoedel commented 3 years ago

Version of OpenTTD

1.11

Expected result

OpenTTD should only ask once to get permission to access the documents folder (works fine in vanilla OpenTTD)

Actual result

With every game launch the user is asked to grant permissions for the game to access the documents folder.

Steps to reproduce

Launch the game a few times on macOS (11.2.3)

image

Not sure if that is easy fixable or if that would require the application to be signed which is only possible with an Apple developer account.

Sorry for all the issues I create, I just drop whatever I find. Feel free to close if it's not fixable or not worth investing a lot of time :)

ldpl commented 3 years ago

Does that happen with older version of vanilla that aren't signed? Unfortunately I'm unable to test or support macos version in any way, so if it works it works if not I can only remove it. If it can be solved with a patch, well, PRs are welcome. SIgning may be possible in future via openttd account it devs figure out something for patchpacks. But for now I don't see how I can change anything about this issue.

yan-zaitsev commented 2 years ago

@danidoedel I have meet the same issue. My quick solution: Open OpenTTD with Terminal:

  1. Open Terminal
  2. Enter /Applications/OpenTTD.app/Contents/MacOS/openttd
yan-zaitsev commented 2 years ago

I have tried to look into source codes and fix is not easy. As I understand, app requires to implement Security-Scoped Bookmarks and Persistent Resource Access from https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html In this case, src/fileio.cpp had to be modified a lot to ask user for first time using NSOpenDialog class, then store security bookmark and use it later.

James103 commented 1 year ago

Are you still having this issue? If so, try running the following command:

codesign -s - --deep /Applications/OpenTTD.app (replace the path with the actual path to your OpenTTD cmclient installation)

Warning: This signs recursively into the app's folder. Do not use if you don't fully trust the app. See https://github.com/JGRennison/OpenTTD-patches/issues/318#issuecomment-1139597073

Source of command: https://github.com/qbittorrent/qBittorrent/issues/16728