FreeTube
FreeTube copied to clipboard
Store data and settings in portable directory with portable version
It seems that the portable version store its settings and data within the AppData folder structure in Windows. For a portable application, the data and settings should reside within the application's directory.
Correct, that is why I think the portable version should NOT use the registry settings. It should keep the data within the portable directory.
I'm using the portable version. It is saving to: %AppData%\Roaming\FreeTube
One of the bigger problems I have is I run the portable version from a network share. The portable version isn't using the network share.
@snakyjake1
I make some tests and:
-
If you run it from
\\server\share
the GUI will not appear on the screen but the%AppData\Roaming\FreeTube
will be created, also someFreeTube.exe
processes are started (check Task Manager). -
But if you map your network share as drive with letter (for example
Z:\
) FreeTube will work, of course will store the settings in the%AppData%\Roaming\FreeTube
on your device. In my case it starts slowly from the mapped network share.
In the next release I will change the SupportsUNC=yes
to SupportsUNC=no
for the portable launcher that I maintain. This will not running the FreeTubePortable from \\server\share
and will inform the user why this happen.
Is it possible to add a config variable to place the configuration in a user specified location and not %AppData%..... not matter where it is run from? This was my original post subject.
At the moment, the data path is hardcoded as the path Electron uses by default
I found this code https://github.com/getferdi/ferdi/blob/develop/src/index.js#L13:L23
And modified the index.js
with the code below and it's working.
...
import Datastore from 'nedb'
const path = require('path')
// Set app directory before loading user modules
if (process.env.FREETUBE_APPDATA_DIR != null) {
app.setPath('appData', process.env.FREETUBE_APPDATA_DIR)
app.setPath('userData', path.join(app.getPath('appData')))
} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.name}AppData`)
app.setPath('userData', path.join(app.getPath('appData'), `${app.name}AppData`))
} else if (process.platform === 'win32') {
app.setPath('appData', process.env.APPDATA)
app.setPath('userData', path.join(app.getPath('appData'), app.name))
}
require('electron-context-menu')({
...
I move the const path = require('path')
to be after line 3 import Datastore from 'nedb'
because of error 'path' was used before it was defined no-use-before-define
.
With the environment FREETUBE_APPDATA_DIR
the whole data is stored in a folder that I want, but there is one little issue: the empty folder Dictionaries
is still created in %AppData%\FreeTube
.
Please note that I'm not a programmer. I hope this code will help to created trully portable FreeTube.
Hi, so thanks for checking on this. It'd be great if you could create a Draft Pull Request for any code changes for this issue. Then it is easier to discuss and direct any necessary changes :)
Any updates on this? App's still not portable.
Adding a --user-data-dir=
to the Target
field on the shortcut will save the data and the settings anywhere you want.
For example: path\to\FreeTube.exe --user-data-dir=.\Data
will create a folder Data
in the same folder where is the FreeTube.exe
(don't miss the dot after =
). Note: This will not prevent creating a strings in the registry.
I will add this argument to the next release of FreeTube in PA.com format.
In my case the data folder size is reduced (I re-create the profile) and the app start more faster, may be because of not moving the data to %AppData%
.
I also try this cmd line argument with some other electron apps and it work.
Is there an eta for the fix?
So after 3 years, the portable version is still not portable.
https://github.com/deltachat/deltachat-desktop is also Electron based and has a working portable variant so I guess everything needed should be in it's source code.