-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Store config in alternative location (portable app) #645
Comments
This would make rollouts so much better as well, to set defaults in a .ini file, please. |
It is pretty standard for apps these days to store their config inside the User folder so that many users can use the same app with diffferent configs, and you don't lose config if you delete the app (this is how it works on Linux, Mac and I believe also most Windows apps nowadays), because LosslessCut uses electron-store which uses getAppPath: Per-user application data directory, which by default points to: We can leave this open as a feature request but I'm not going to prioritize this anytime soon, because I don't know an easy way to do this (maybe it could be done with a command line flag ( |
It makes absolutely sense why you used the popular user/platform default folders to store (user specific) app settings, we are just saying if we additionally could support using a local stored config file only when present (or take priority over present user setting), that this would make it fully portable as well as potentially easier for rollouts to multiple laptops. I use ShareX and Greenshot which use this, they also have full installers besides fully portable versions which is nice. We are currently building an installer via app deployment tool to deploy/make available via software center (SSCM), I will check out to utilise the current setting files, biggest hurdle is the lack of uninstall support due to no installer #521/#86.) Perhaps we could use a specific relative path via 'app.setPath(name,path)` as per https://stackoverflow.com/a/30610157/8719001 post. (There is also a module called electron-json-storage in case that can be helpful, however a .ini file is more common to most people / editor friendly.) |
Yea could use setPath but then we would need to know when to call that instead of the default. (It cannot be a setting for obvious reasons) |
In addition, Electron internally uses the same path for storing a bunch of chrome caches and configs etc, i’m not sure if those would be affected by setAppPath too. If not then I’m pretty sure the app would crash if AppPath is not writable by the user |
Can the path for the settings storage not be different that that used for Chrome caches and other stuff also used by electron? Unfortunately don't know anything about electron, just googling myself. 😄 If yes I imagined that we could perhaps have a logic check to see if config.ini is present in the same folder as losslesscut.exe and if so use that for settings instead of user data directory, (otherwise fault back on default using user data directory). |
If settings are still stored in User/AppData, then it would break the promise of not leaving traces on the computer. |
LC could check if a subfolder "settings" exist in the LC installation folder. If this subfolder exists then LC uses the files inside this folder otherwise LC looks in the default User/AppData directory. I don't know in which programming language LC is written. So in pseudo code it would look like:
So making LC portable costs only 3 tiny lines of source code more. Is this too difficult? |
Shouldn't require a folder just a file in the same folder where the exe is to keep it simple. Yes if electron still requires user/App Data folder that may not be fully portable or without trace, but this is happening currently regardless thus the main benefit is being able to deploy or use it portable including preconfigured settings . That's why we need it and should implement it. Potentially it could be also a setting to enable local settings which creates the config.ini file and when present use that to populate all default settings and update with any changes made in the app, that would also make it user-friendly for changing settings as one just does the changes in the app and can copy or backup the config file. (and we can have a remark that some settings or data needs to be stored in User/AppData). 😄 Portable app settings is more practical while potentially avoiding or removing temporary data would be a nice to have in comparison in my option (but maybe this can be figure out as well). |
I'm not going to spend too much time on this, but I will add a check for whether a config file exists in the app dir getAppPath |
I know nothing about electron-store, but IMO it should be putting things in preferences files, not though I guess if you have a whole bunch of different unrelated files, that's ok.. but I think of configuration info as largely the same as user preferences for an app. i.e. it should be in a plist file in ~/Library/Preferences/ (on the Mac obviously) |
I will only make the "portable" change for Windows. MacOs/Linux will always be using electron |
will be out in the next ver |
Thanks, but how do we set it to portable mode on Windows since the 3.33.1 ? |
Put an config.json file containing |
How should users this know? Wouldn't it be easier if you create a clickable checkbox/button/menu in GUI with the label "Run in portable mode" which prepare everything necessary? |
either that or a command line flag to start it in portable mode can be done. I just don't think a lot of people need that, and if they do, then they can now still achieve it by creating this config file. |
Thx for your feedback @mifi . I disagree in a sense that they are much more users than you think who prefer to have an app running in portable mode, simply to avoid leaving any trace or any leftovers in case they don't use it anymore. A neat way would to have an App & Data folder and a shortcut on the root level. Whether this is a achieved through a json file or portable command line flag is ok, as long as it's described somewhere. Thx for your consideration |
The problem is that it is not that simple because lc is using a framework called electron which has some ways of doing things, like storing appdata.
Are you running single EXE version? can you check developer tools if it logs |
Sorry I'm not understanding your first answer as I'm not a developer. For the exe, I'm using your zip version and there is only one LosslessCut.exe file in the root folder, where I put the config.json file there. I've opened the developer tools and didn't find the customStoragePath log anywhere. Launching the exe from cmd,gives me "(electron) The default value of app.allowRendererProcessReuse is deprecated, it is currently "false". It will change to be "true" in Electron 9." |
sorry those were just some notes for myself (and any other devs). In layman terms I believe it's not possible to have it store the other files (Electron app data) in the same dir as the exe file after detecting a config.json next to the exe because it is too late (electron has already stored the files in Roaming by then). if we want to store those files also next to exe, I think we need to run losslesscut with a command line flag that says to use exe dir for storage of those. but then the user would have to start lc with a command line flag every time, i'm not sure how nice that is. |
As for why config.json doesn't work, I have to look into that. I only tested on mac and here it worked, so i need to fire up a windows vm to test |
Has there been any progress on the feature? I have noticed that placing config.json containing {} next to the exe doesn't do anything. |
Are you running the self-contained LosslessCut-win.exe from github, e.g. this one? https://github.com/mifi/lossless-cut/releases/download/v3.39.0/LosslessCut-win.exe I think that version is a self-extracting exe archive, and will extract all files into a temp directory like maybe Meanwhile I found this and will look into it: |
I've been using the zip version from the very beginning. |
Ok it seems there was a bug, where I used |
For folks who would like the Electron data in AppData handled as well, we've released Lossless Cut Portable at PortableApps.com. It uses the config.json method mentioned above as well as moving files to/from %APPDATA%\LosslessCut. It also adjusts paths within config.json as you move between computers. |
@JohnTHaller that's great! BTW you can all try the latest version from github, hopefully the config issue is solved |
Closing for now. I'll reopen if still an issue |
Where are settings of LC stored?
I can't see a file like losslesscut.ini in installation folder
So it must me either in Windows Registry or in User App folder.
Unfortunately LC is not portable this way.
I would like to run it from USB flash drive on various computers and without leaving traces on the computers.
So could you make it really portable?
The preferences should be stored in an *.ini or *.xml file in Losslesscut folder.
Thank you
Peter
The text was updated successfully, but these errors were encountered: