kiwix / kiwix-desktop

Kiwix for Windows and GNU/Linux desktops
https://download.kiwix.org/release/kiwix-desktop/
GNU General Public License v3.0
776 stars 101 forks source link

Implement portable mode #1179

Closed sgourdas closed 2 months ago

sgourdas commented 3 months ago

This adds a check for the .portable file besides the executable. If it exists all application files will be saved in the data directory.

Fixes #1166

kelson42 commented 3 months ago

@sgourdas What is exactly the status here? It is mark ready to review, but still WIP and no reviewer? It's unclear.

sgourdas commented 3 months ago

Changing to draft since getDataDirectory is not merged yet. I have finished work on the others.

kelson42 commented 2 months ago

@sgourdas If there is a blocker, please write it clearly. Now that the data directory PR are merge, does that mean this PR is ready to review? @sgourdas Please rebase an fix conflict.

sgourdas commented 2 months ago

Rebased with main and completed changes. Ready for review.

veloman-yunkan commented 2 months ago

WIP qualifier is no longer pertinent, I guess

kelson42 commented 2 months ago

@sgourdas Sorry for the lack of feedback here, will look ASAP

kelson42 commented 2 months ago

@sgourdas Any update?

sgourdas commented 2 months ago

Sorry for the delay. I will update ASAP.

kelson42 commented 2 months ago

@sgourdas Please ensure this PR fixes #460 properly

sgourdas commented 2 months ago

Please update https://github.com/kiwix/kiwix-desktop/wiki/Data-and-Configuration-Files with a new "portable" column as well.

@kelson42 what should the "portable" column have as information?

kelson42 commented 2 months ago

Please update https://github.com/kiwix/kiwix-desktop/wiki/Data-and-Configuration-Files with a new "portable" column as well.

@kelson42 what should the "portable" column have as information?

The relative paths where the file are read/written

sgourdas commented 2 months ago

Please update https://github.com/kiwix/kiwix-desktop/wiki/Data-and-Configuration-Files with a new "portable" column as well.

@kelson42 what should the "portable" column have as information?

The relative paths where the file are read/written

I have set it up so in portable mode all files are written in the data folder besides the executable. Since it is all the same maybe just a note under the table would be enough?

sgourdas commented 2 months ago

@veloman-yunkan I added support also for the download directory and .conf file to work appropriately in portable mode.

sgourdas commented 2 months ago

But regarding the portable functionality I have the following questions:

  1. Should we allow the user to change/set the download and monitored directories in portable mode?
  2. Should we allow adding ZIM files from outside the USB drive to the library in portable mode?

I was thinking about this too and how strict we should be with the portable mode.

IMO we should not be very restrictive and let the user choose. But, with the current implementation, if the download directory is changed and mode is portable, it would be set back to the data folder on app restart, which I dont think is proper, but adds some complexity if we want to tackle.

veloman-yunkan commented 2 months ago

But, with the current implementation, if the download directory is changed and mode is portable, it would be set back to the data folder on app restart

How come it works like that? Isn't the download directory setting saved in the kiwix-desktop.session file?

sgourdas commented 2 months ago

But, with the current implementation, if the download directory is changed and mode is portable, it would be set back to the data folder on app restart

How come it works like that? Isn't the download directory setting saved in the kiwix-desktop.session file?

It does usually, but not in portable mode as per this PR.

settingsmanager.cpp:192

kelson42 commented 2 months ago
1. Should we allow the user to change/set the download and monitored directories in portable mode?

Why not? But to me this is something different: I have created https://github.com/kiwix/kiwix-desktop/issues/1203

I believe that per default, the data directory should be monitored, see my comment.

2. Should we allow adding ZIM files from outside the USB drive to the library in portable mode?

Why, not? At the end this is also a topic which is relevant for #1203 IMHO