Skip to content

Commit

Permalink
Added a workaround for reading the main assets folder on macOS.
Browse files Browse the repository at this point in the history
FINALLY! You thought you could best me, Gatekeeper?? Of all of the
people you chose to mess with, you messed with me! ME!! You have NO
idea how much time I'm willing to spend on fixing something, and this
felt SO GOOD TO FIX. For ages macOS players would have to extract the
game in their Downloads folder so that the game could reach the default
asset pack from within quarantine, but once I learnt that Godot has
a function to return the executable path, and that .app bundles are just
folders... that was the moment the wall crumbled.

In case it was not immediately obvious...

I. AM. SO. HAPPY. :D
  • Loading branch information
drwhut committed Nov 25, 2022
1 parent c546740 commit 9dca836
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/general/download/compiling_from_source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ game through the editor to play it. Here's how you can export the project:
5. Copy the ``tabletop-club/assets/`` folder next to the exported binary, so
the game has assets to import.

.. note::

On macOS, you'll need to put this folder inside the ``.app`` package,
specifically in ``Tabletop Club.app/Contents/Resources``.

Now, you should be able to launch the exported executable and play the game
directly!

Expand Down
9 changes: 3 additions & 6 deletions docs/general/download/downloading_binaries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,10 @@ Downloading for macOS
``TabletopClub_vX.X.X_OSX_Universal.zip``.

2. When it has downloaded, go to your downloads folder in Finder, and find
the compressed file. Double-click the file to extract the folder - it will be
called something like ``TabletopClub_vX.X.X_OSX_Universal``.
the compressed file. Double-click the file to extract the application.

3. Re-name the new folder to ``TabletopClub``.

4. Go into the folder, and launch the game by right-clicking ``TabletopClub``
and clicking :guilabel:`Open`.
3. Launch the game by right-clicking ``TabletopClub`` and clicking
:guilabel:`Open`.

.. note::

Expand Down
2 changes: 2 additions & 0 deletions game/Scripts/AssetDB.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum {
const ASSET_DIR_PREFIXES = [
".",
"..",
"{EXEC_DIR}/../Resources", # macOS workaround.
"{DOWNLOADS}/TabletopClub",
"{DOCUMENTS}/TabletopClub",
"{DESKTOP}/TabletopClub"
Expand Down Expand Up @@ -171,6 +172,7 @@ func get_asset_paths() -> Array:
var out = []
for prefix in ASSET_DIR_PREFIXES:
var path = prefix + "/assets"
path = path.replace("{EXEC_DIR}", OS.get_executable_path().get_base_dir())
path = path.replace("{DOWNLOADS}", OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS))
path = path.replace("{DOCUMENTS}", OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS))
path = path.replace("{DESKTOP}", OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP))
Expand Down

0 comments on commit 9dca836

Please sign in to comment.