Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3417 Symlinks to Directories in Mods Dir Aren't Traversed #3418

Conversation

rehashedsalt
Copy link
Contributor

@rehashedsalt rehashedsalt commented Nov 19, 2023

Fixes #3417

Adding a single option to this directory iterator allows Ship to recurse into directories targeted by symlinks.

Build Artifacts

@rehashedsalt rehashedsalt changed the base branch from develop to develop-macready November 19, 2023 20:09
@rehashedsalt
Copy link
Contributor Author

Works well on Linux

[toolbox:~/Projects/Shipwright/build-cmake/soh]$ ./soh.elf 
[2023-11-19 14:50:29.711] [info] [Archive.cpp:455] Opened mpq file /var/home/salt/Projects/Shipwright/build-cmake/soh/soh.otr.
[2023-11-19 14:50:29.755] [info] [Archive.cpp:455] Opened mpq file /var/home/salt/Projects/Shipwright/build-cmake/soh/./oot.otr.
[2023-11-19 14:50:29.823] [/var/home/salt/Projects/Shipwright/libultraship/src/resource/Archive.cpp:455] [info] Opened mpq file /var/home/salt/Projects/Shipwright/build-cmake/soh/./oot.otr.
[2023-11-19 14:50:29.845] [/var/home/salt/Projects/Shipwright/libultraship/src/resource/Archive.cpp:488] [info] (/var/home/salt/Projects/Shipwright/build-cmake/soh/soh.otr) Patched in mpq file.
[2023-11-19 14:50:29.858] [/var/home/salt/Projects/Shipwright/libultraship/src/resource/Archive.cpp:488] [info] (/var/home/salt/Projects/Shipwright/build-cmake/soh/./mods/testmoddir/Updatables/daruniasjoy.otr) Patched in mpq file.
[2023-11-19 14:50:29.865] [/var/home/salt/Projects/Shipwright/libultraship/src/resource/Archive.cpp:488] [info] (/var/home/salt/Projects/Shipwright/build-cmake/soh/./mods/testmoddir/Updatables/ganondorfsorgan.otr) Patched in mpq file.
[2023-11-19 14:50:30.833] [/var/home/salt/Projects/Shipwright/libultraship/src/public/libultra/os.cpp:22] [error] Failed add SDL game controller mappings from "./gamecontrollerdb.txt" (Invalid RWops)
[2023-11-19 14:50:34.774] [/var/home/salt/Projects/Shipwright/soh/soh/z_play_otr.cpp:92] [info] Scene Init - sceneNum: 0x51, entranceIndex: 0xcd
[2023-11-19 14:50:34.776] [/var/home/salt/Projects/Shipwright/soh/soh/z_scene_otr.cpp:544] [info] Room Init - curRoom.num: 0x0
^C^C[toolbox:~/Projects/Shipwright/build-cmake/soh]?$ ll mods
total 4.0K
lrwxrwxrwx. 1 salt salt 13 Nov 19 14:50 testmoddir -> ../testmoddir/
[toolbox:~/Projects/Shipwright/build-cmake/soh]$ ll testmoddir/
total 0
drwxr-xr-x. 1 salt salt 68 Nov 19 13:22 Updatables/
[toolbox:~/Projects/Shipwright/build-cmake/soh]$ ll testmoddir/Updatables/
total 4.1M
-rw-r--r--. 1 salt salt 2.9M Nov 19 13:22 daruniasjoy.otr
-rw-r--r--. 1 salt salt 1.2M Nov 19 13:22 ganondorfsorgan.otr

@rehashedsalt
Copy link
Contributor Author

Performance AppImage works well. Dropped it into an install where I first observed the bug and it picked everything right up.

Windows build is also happy with symlinks made with mklink /D

For testing:

  • Create a directory outside of ./mods (say, ./symlinktest)
  • Populate that directory with OTR files
  • Create a symbolic link in ./mods that points to that directory (./mods/test -> ./symlinktest)
  • Launch Ship
  • Verify if Ship picks up on the custom resource OTRs

Link to Darunia's Joy for your convenience

@Archez
Copy link
Contributor

Archez commented Nov 19, 2023

Confirmed working on mac when using ln -s.
Finder's "make alias" does not work, but that is to be expected since that is only really usable with Finder (those are not unix friendly).

@rehashedsalt
Copy link
Contributor Author

Yeah, Windows Shortcuts don't work for a similar reason.

@briaguya-ai briaguya-ai merged commit d50ad47 into HarbourMasters:develop-macready Nov 24, 2023
8 checks passed
@rehashedsalt rehashedsalt deleted the fix-mod-dir-symlink-recursion branch November 25, 2023 19:42
A-Green-Spoon pushed a commit to A-Green-Spoon/Shipwright that referenced this pull request Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Symlinks to Directories in Mods Dir Aren't Traversed
3 participants