You are here

Setting Windows $HOME and or %APPDATA% paths in FreecivPortable.ini

8 posts / 0 new
Last post
port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
Setting Windows $HOME and or %APPDATA% paths in FreecivPortable.ini

- hi everyone from a long time user, first time poster and shout out to @dagardner for PAL packaging Freeciv

I'm trying to figure out $HOME and %APPDATA% variables for Freeciv while switching between Win 7 and 10 laptops and believe the issue is related to the .ini settings for that particular app hence this post in this subforum. My apologies if mistaken.

*Problem:*
settings and save files created by Freeciv and stored in %APPDATA% are flushed inbetween app usage.
*Current workaround:*
manually copying settings and save files from %APPDATA% before closing the app.
*Desired outcome:*
point the path away from %APPDATA% to a folder within the portable apps folder instead.

As per Freecivs FAQ, 3.7, it creates a configuration file and a /saves subfolder in $HOME which defaults to %APPDATA% at C:\Users\username\AppData\Roaming\.freeciv\. (see 3.7 in https://github.com/freeciv/freeciv/blob/master/doc/FAQ)

Usually when I close Freeciv this folder is flushed. Sometimes it isn't.
Other times the content is copied to FreecivPortable\Data\settings\.freeciv before flushing.

Rarely (hate to be vague here, sorry), upon re-opening Freeciv, is the content of ....Data\settings\.freeciv copied back to ...AppData\Roaming\.freeciv.
Mostly (sorry again) it isn't, which caused a few hours of confusion during troubleshooting today.

My Windows 7/10 understanding is that $HOME is globally set for all installed apps. If that's correct how do a single app bypass that?

Glancing at FreecivPortable\App\AppInfo\Launcher\FreecivPortable.ini and the commented ;HOME=%PAL:DataDir%\settings line makes me assume it can be solved from there:

[Launch]
ProgramExecutable=Freeciv\freeciv-gtk3.exe
WorkingDirectory=%PAL:AppDir%\Freeciv
DirectoryMoveOK=yes
SupportsUNC=yes

[Environment]
LANG=%PAL:LanguageCustom%
;HOME=%PAL:DataDir%\settings

[FilesMove]
settings\stderr.txt=%PAL:AppDir%\Freeciv
settings\.freeciv-client-rc-2.5=%APPDATA%

[DirectoriesMove]
settings\.freeciv=%APPDATA%\.freeciv

I've scoured the well-documented Freeciv files (thanks to excellent portable Geany find in files search) but didn't find any noob friendly how-to steps that suggests editing one of its config files.

There's a command line option to avoid %APPDATA% (see 3.9 in the FAQ, link above) but some of my junior warmates will probably not be able to use cmd and it's much easier just to share a copy of my 'custom' Freeciv portable folder that works as intended.

port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
2 troubleshooting notes FWIW:

2 troubleshooting notes FWIW:

the flushing of APPDATA seems to be affected by whether Freeciv is closed by quitting directly from inside a game instead of leaving it first, and then quitting from main menu

FreecivPortable.ini calls
settings\.freeciv-client-rc-2.5=%APPDATA%

but the created file is numbered freeciv-client-rc-2.6

/best regards
/and high hopes Smile

John T. Haller
John T. Haller's picture
Offline
Last seen: 8 hours 11 min ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
HOME stopped working, additional line

HOME stopped working a while back. If you add another lines of settings\.freeciv-client-rc-2.6=%APPDATA% after the first, does it handle it?

Sometimes, the impossible can become possible, if you're awesome!

port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
thanks for checking John

thanks for checking John

No difference unfortunately and freeciv-client-rc-2.6 files are being created in either APPDATA and sometimes ....civportable\Data\settings till now anyway

And it is actually working as intended on the Win 10 laptop so it seems to be a Win 7 host issue of some kind.
Which makes sense I guess, a bug like that should have been discovered since release Andy packaged it back in March.

Re-installing then.

port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
and it works fine fine fine now, so.....

apologies for the noise and sloppy troubleshooting, the hoops and loops between native Freeciv settings and PAL threw me off there and some noob lines or uncomments must have sneaked in somewhere along the way.

port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
The bug was reproduced and located

to https://portableapps.com/apps/utilities/cubicexplorer_portable, last updated 2014-04-04 and by far the best Windows file explorer I've tried so far.

But when either settings\.freeciv or %APPDATA%\.freeciv are open in one of its panes it blocks the path for [FilesMove] and [DirectoriesMove].

So new saves can't be saved or copied over and at some occasions Freeciv cant start a new game server.

When %APPDATA% is locked it creates a new .freeciv.BackupByFreecivPortable dir.
Windows Explorer (native) does not lock either path inbetween restarts, it just jumps to the Backup dir.

Let me know if this should be flagged in the cubicexplorer readme or something like that.

John T. Haller
John T. Haller's picture
Offline
Last seen: 8 hours 11 min ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Why Open

Curious why you had it open? If something is locking a given directory, most apps will be unable to move things back and forth.

Sometimes, the impossible can become possible, if you're awesome!

port-trainee
Offline
Last seen: 3 weeks 2 days ago
Joined: 2020-08-30 19:22
curious as well, I guess when

curious as well, I guess when the flushing started I kept an eye on it and hard copied now and then

then it took a few more monkey type trial & error runs to discover that data/settings/.freeciv (of course) was blocked as well

that was probably open first for whatever random reason but hey...

and it didn't occur to me until after seeing a bunch of save failed, can't write to C:\... msgs that it had to be a path access issue

Log in or register to post comments