Skip to content

Comments

Implement portable mode#250

Merged
Shivansps merged 6 commits intoKnossosNET:mainfrom
Shivansps:portable-mode
Jan 4, 2025
Merged

Implement portable mode#250
Shivansps merged 6 commits intoKnossosNET:mainfrom
Shivansps:portable-mode

Conversation

@Shivansps
Copy link
Member

@Shivansps Shivansps commented Oct 26, 2024

Add portable mode, to enable this mode create a "kn_portable" folder in the same folder as were the Knet executable is in.

Then Fso prefereces (if supported) will be at:
\kn_portable\HardLightProductions\FreeSpaceOpen\

Knet data folder
\kn_portable\KnossosNET\

Knossos Library path:
\kn_portable\Library\

In portable mode you cant change the library path.

The FSO preferences path is passed via a env variable, im attaching a FSO build that support this
-removed- use a nightly build newer than 24.3.0-20241211

scp-fs2open/fs2open.github.com#6387

If the FSO version dosent support the changing the preferences path, "-portable_mode" will be passed instead, and settings and pilots will be saved to the working folder.

I only tested it in Windows, this needs more testing, specially on other OS and ill need to update the readme as well.

@Shivansps Shivansps added the enhancement New feature or request label Oct 26, 2024
@Shivansps Shivansps added this to the 1.3 milestone Oct 26, 2024
@Shivansps Shivansps linked an issue Oct 26, 2024 that may be closed by this pull request
@wookieejedi
Copy link
Contributor

I also tested on Windows, I wonder if @notimaginative might be able to test on Linux or Mac?

@notimaginative
Copy link
Contributor

I'll give it a test as soon as I get the chance. Might be a few days though.

@Shivansps
Copy link
Member Author

I'll give it a test as soon as I get the chance. Might be a few days though.

im particulary worried about appimage, it might not be able to see the folder.

@Shivansps
Copy link
Member Author

Ok since the change was merged in FSO, i changed the minimal FSO version for the custom preferences path support to 24.3.0-20241211, so current nightly should work correctly with the custom FSO preferences path set inside the "kn_portable" folder.

@notimaginative
Copy link
Contributor

The appimage worked without issue. The Mac app requires code changes since the binary directory and the application directory aren't the same with a Mac bundle.

I need to clean up my Mac test code and make a utility function for it (same path finding code is used for updates), then I'll post a diff of the needed modifications.

I should also add that for these tests I'm simply creating a kn_portable directory in the same location as the app. If there is more to it than that let me know and I'll run the tests again.

@Shivansps
Copy link
Member Author

Shivansps commented Dec 29, 2024

that should be fine.
The only detail is that current FSO nightlies should be able to save preferences inside
'\kn_portable\HardLightProductions\FreeSpaceOpen'

So as long as GetFSODataFolderPath() returns an absolute path, it should be fine.

@Shivansps
Copy link
Member Author

Should i merge this and you PR the changes later or i should wait?

@notimaginative
Copy link
Contributor

notimaginative commented Dec 31, 2024

Here's the diff. Feel free to change that any way you like if there is better method to get the same result.

pr250-Mac_fix.patch

I got stuck trying to debug a crash-on-exit with the Mac build, but that happens on main as well so it's not an issue with this PR. VSCode is jerking me around with installed dotnet versions and other nonsense and I haven't had the time/energy to sort that out and debug the crash.

@Shivansps Shivansps merged commit 41e8eeb into KnossosNET:main Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Portable mode

3 participants