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

Added a Portable mode #364

Closed

Conversation

kevinfoley
Copy link
Contributor

Added support for running TFE in "Portable Mode", where temporary files and user documents are stored in subfolders inside the executable directory. Portable mode can be activated in either of two ways:

  • By launching the executable with the new command line argument -portable
  • By adding a file named PORTABLE to the executable directory

User documents are saved within a new directory named UserDocs inside of the executable directory.

Tested on Windows 10 and Fedora 38/KDE Plasma

…file named "PORTABLE" to the executable directory. Works on Windows, need to test on Linux
@luciusDXL
Copy link
Owner

I have to go through this one again, but I will do so in the next few days.

@mlauss2
Copy link
Contributor

mlauss2 commented Oct 25, 2023

just bikeshedding here:

  • Maybe add an envvar too? i.e. "TFE_PORTABLE=1 ./theforceengine",
  • Maybe make it configurable as default behaviour (thinking about a flatpak here again where everyhing the needs is where the exe is, like windows).

Hm?

@luciusDXL
Copy link
Owner

luciusDXL commented Oct 25, 2023

just bikeshedding here:

  • Maybe add an envvar too? i.e. "TFE_PORTABLE=1 ./theforceengine",
  • Maybe make it configurable as default behaviour (thinking about a flatpak here again where everyhing the needs is where the exe is, like windows).

Hm?

I'm not a fan of using an environment variable on Windows. That said, making it configurable via CMake sounds like a great idea for Linux. That addition can be done as a separate PR I think.

@Tartifless
Copy link

Avoid environment variable, argument or presence of a portable.txt file is the way to go

@mlauss2
Copy link
Contributor

mlauss2 commented Jan 22, 2024

Avoid environment variable, argument or presence of a portable.txt file is the way to go

Thinking about it again, yes, it's a stupid idea. But making it default via cmake for e.g. a flatpak build would be advantageous.

@Tartifless
Copy link

Hello, any news regarding this feature, are there any plans to integrate it in the next release ?

@kevinfoley
Copy link
Contributor Author

Hello, any news regarding this feature, are there any plans to integrate it in the next release ?

@luciusDXL ?

@luciusDXL
Copy link
Owner

I need to go through this again and either merge it or implement my own version. It won't be in the next release, but should follow soon after.

@luciusDXL
Copy link
Owner

luciusDXL commented Jul 20, 2024

I was investigating problems with Documents/ on Windows - mainly due to OneDrive - and realized that on failure the system was already supposed to use the local directory. That wasn't quite happening (not checking in all of the correct places), but with that in place it made sense to directly support portable installs.

So I basically implemented it, then remembered this PR. My version is similar but with some notable differences:

  • There is no commandline option or env variable, since most Windows users wouldn't use it.
  • Instead of creating a new file, you get the "portable" behavior by placing a settings.ini file in your TFE directory (if it is empty, it treats it like a first run, but you can safely copy the existing data as well) - this is similar to the way GZDoom handles it.
  • It doesn't create another sub-directory, most people wouldn't link "MyDocs" to settings, saves, logging, etc. and there are only a few loose files in the release distribution.

Thanks for taking the time to implement this @kevinfoley. I'm going to close it now.

@luciusDXL luciusDXL closed this Jul 20, 2024
@Tartifless
Copy link

Tartifless commented Jul 20, 2024

Hello Lucius, will this be implemented in next version ?

I tried putting a settings.ini file in my forceengine folder, but it still uses the one in Documents

@luciusDXL
Copy link
Owner

I have not released a new version with this code yet, it is work that will be included in the next release.

@Tartifless
Copy link

Hello, thanks, indeed I figured that out by looking at the commit history.
Anyway, very much appreciated

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.

4 participants