Repository navigation
Backend: support a data folder on an external drive (#747, part 1) - #759
Merged
Merged
Conversation
The data folder can become a link to a folder on an external drive (~/.metalsharp -> /Volumes/<Drive>/MetalSharp). The kernel reports processes' executables and working directories resolved, so the matchers that tell MetalSharp's Wine, Steam, games and Ubisoft processes apart now compare against resolved roots (ms_resolved_path_within); without it nothing would be seen running and Stop would miss it. Guards that refuse the data folder or an emulator's own folder resolve it too; Sharp library and Epic paths inside the data folder are kept through it, so a renamed drive keeps them valid; the internal Steam library is not labelled external; migration keeps its copy of prefixes on the data folder's drive; Steam's Desktop shortcuts are copied across drives. On the x86_64 build, with the data folder on another drive, Wine Steam starts directly when the MetalSharp Steam helper does not start it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of #747 (data folder on an external drive). This PR changes only the backend, in both builds, so it works when
~/.metalsharpis a link to/Volumes/<Drive>/MetalSharp. Part 2, the app's drive choice, disconnected-drive screen and Move in Settings, follows in a separate PR.With the data folder internal, as it is for everyone today, behavior is unchanged: every new comparison resolves to the same path, and every new branch applies only when the data folder is on another drive.
Why
Launches already work through the link: argv, env,
launch.envand the Wine wrappers all use~/.metalsharp, and nothing renames across drives or uses clone copies. But the kernel reports each process's executable (proc_pidpath) and working directory (PROC_PIDVNODEPATHINFO) resolved, as/Volumes/<Drive>/MetalSharp/.... Wine processes show Windows command lines, so those paths are the only way to tell MetalSharp's processes apart. Compared against~/.metalsharp/...text, they never match. Steam, games and Ubisoft Connect would never show as running, Stop would miss them, and MetalSharp could start Steam a second time.Changes
ms_resolved_path_within(path, root)inwine_runtime.ccompares againstrealpath(root), or the text as written when it doesn't resolve. It's used bysteam_actions.c(process_cwd_within,process_executable_within: Wine Steam detection, stop and cleanup, Steam-launched games, the Ubisoft/Odyssey scans, the process list),process.c(game detection and kill) andubisoft.c.sharp.candgamejolt.calready resolved their roots.gog.csafe_gog_install_pathalso refuses the resolved data folder.steamcmd.cno longer labels the internal library (now under/Volumes/) as external.ms_data_path_for_keeping(home, path)converts a resolved path inside the data folder back to its~/.metalsharpform. The Sharp library (exe_path,install_dir) and Epic custom install roots use it, so a renamed drive doesn't break saved entries.migration.c): the safety copy of prefixes and games, which can be many GB, goes on the data folder's drive when that isn't/tmp's, instead of on the internal disk..urlfiles are copied, then removed, whenrenamefails across drives (EXDEV).openhas already succeeded. The fex build already starts Wine Steam directly for this reason. With the data folder on another drive, the helper path now waits up to 6 s for Wine Steam to appear, then starts it directly instead. With internal data it's unchanged.Drive letters are unchanged on purpose. The data drive can also hold Steam libraries, which need their letter.
Testing
make -C app/src-c testandmake -C app/src-c VARIANT=fex testpass. Both variants build with-Werror.wine_runtime_testnow builds a real linked data folder (data -> drive/MetalSharp) and checks:.clang-format.