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
Use XDG directories #3218
Use XDG directories #3218
Conversation
Hi @qarkai Great, thanks! There is also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qarkai , I left multiple comments in this pull request. Could you please take a look?
Made changes. Don't know how I "close" changes request though. |
There's no need to close them. Resolving them is enough :) |
I tested this branch when building |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qarkai , I left two questions. Could you please take a look?
Hi! |
Hi @qarkai , I think @Branikolog has a point regarding Windows systems. Putting files somewhere outside initial directory might be misleading for users. |
Hi @ihhub, I believe that user's files should be kept in user's directories. Consider two people sharing config and saves directory on a computer when one prefers good interface and other prefers evil one. |
@qarkai , actually the biggest majority of our users are on Windows and they aren't expecting files to be stored anywhere else except the folder where the archive is extracted. Also based on the feedback from Linux based forums many users face problems of running the application so I would say geeks is too much. |
The best way is to ask our team to avoid any one side opinions :) @oleg-derevenetz , @LeHerosInconnu and @idshibanov could you please give us your opinion as well? |
Just my 0.02¢ as a geeky Linux user :) Why not checking all the possible locations: first current dir, then XDG dirs? Plus a config option to specify it if needed. This way everyone should be happy. (On NixOS Linux we can't use the current dir) |
I totally agree with you. For example, I have Ubuntu machine and I am totally fine to keep all files within the same directory. |
@karolchmist The problem is with different directories for config and saves. If we search for writeable directory then all files go to which is first in directories list. I believe that config files should be in config dir, since they could be easily regenerated and reconfigured if configure dir is lost but saves should be in data dir. |
From the point of view of the average user, it's always better to have everything in one folder; and the majority of users are more average users than geeks. And for some users, it's already complicated to have to search in subfolders. :D |
@qarkai , my apologies for this as I need to maintain a lot of things so I came back to this pull request once I got time. |
My some cents. Why not use both approaches? |
@ihhub sorry, I didn't mean to be offensive, I really appreciate your work on this project. |
Hi all, How about the following logic: if directory with Additionally, it is possible to add command-line switch to manage this behavior explicitly, for example, |
In this case admins'll break OS-filesystem rules. Admins want to play too. |
Admins will break those rules only if they run app with elevated privileges (through UAC on Windows or as root on Linux). Normally they shouldn't do that. |
Yes, it's unusual, but possible case. If game try to follow OS-specific rules, then it's better when all accounts follow same rules ( XDG for linux, %APPDATA% for win, something for *BSD). Also, is there cross-platform way for getting program path? Because if we run fheroes2 from some PATH directory, then game can't detect program dir. |
Then we should say bye-bye to storing all user files in the app's folder, at least on Windows. No ordinary user will bother to run |
BTW why it's ZIP instead of installer? |
There is |
Hi @qarkai , could you kindly please resolve merge conflicts as I can't do it by myself? |
Hi @Northfear , could you please test these changes on PS Vita as well? |
Checked. Everything seems to be working fine |
Hi @qarkai and @oleg-derevenetz , for Let me please clarify things so everything will be aligned:
Please correct me if I'm wrong. |
Hi @ihhub suppose we have a multi-user system with unrelated users, and one of them bought original HoMM2 game, and the other is not. In this case, files of original game should be stored in user's directory. |
Is the original game installed per user? I use GOG version and everything's installed out of C drive obviously. |
Data files could be stored in user's directory. But nothing prevents from storing them in game's directory (or some common system directory on Linux if |
If files could be stored then we should. As a user I expect that all data files will be in the same directory where my installation is. At least in terms on Window's users. Having data files somewhere else might be odd for many. |
Right now everything works as I described before: demo script downloads files to the same directory where fheroes2.exe locates. While configuration files are in user's directory which is fine. |
Original game is shipped as a whole with data files because owners have copyright for them. We don't have a rights to distribute data files, so I'd be careful here and let each user install it's own data files individually. Also, at one moment we should be able to provide fheroes2 packages, and individual data files are fit for this ideally (BTW, in Linux and MacOS shared data should reside somewhere in /usr/local/share anyway). But it's up to you. I personally see only gains from per-user data files: no copyright issues, one user may have full PoL, while another may have just a demo. |
As a user I'd like to have opportunity storing new maps in my data directory thus avoiding UAC/sudo in order to write them in game's directory in |
Hi @qarkai , thanks a lot for these changes! I've decided to go with them as I feel that I'm dragging you guys with the implementation :) |
I built it on NixOS Linux and it works, thank you 👍 |
Use
$XDG_CONFIG_HOME/fheroes2
on Linux (~/.config/fheroes2
by default) forfheroes2.bin
,fheroes2.cfg
.Use
$XDG_DATA_HOME/fheroes2
on Linux (~/.local/share/fheroes2
by default) fordata
,files/save
,maps
.On other platforms use directory returned by
GetHomeDirectory
.Close #2860.
Close #3118.