Skip to content
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 data and settings in portable directory with portable version #746

Open
zahroc opened this issue Oct 30, 2020 · 13 comments
Open

Store data and settings in portable directory with portable version #746

zahroc opened this issue Oct 30, 2020 · 13 comments
Labels
enhancement New feature or request

Comments

@zahroc
Copy link

zahroc commented Oct 30, 2020

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.

@zahroc zahroc added the enhancement New feature or request label Oct 30, 2020
@rddim
Copy link
Contributor

rddim commented Oct 31, 2020

@zahroc

You can use FreeTubePortable as a workaround. Its deal also with the registry strings.

@zahroc
Copy link
Author

zahroc commented Nov 1, 2020

Correct, that is why I think the portable version should NOT use the registry settings. It should keep the data within the portable directory.

@Snake883
Copy link

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.

@rddim
Copy link
Contributor

rddim commented Nov 25, 2020

@snakyjake1

I make some tests and:

  1. If you run it from \\server\share the GUI will not appear on the screen but the %AppData\Roaming\FreeTube will be created, also some FreeTube.exe processes are started (check Task Manager).

  2. 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.

@zahroc
Copy link
Author

zahroc commented Nov 26, 2020

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.

@GilgusMaximus
Copy link
Contributor

At the moment, the data path is hardcoded as the path Electron uses by default

@rddim
Copy link
Contributor

rddim commented Dec 6, 2020

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.

@GilgusMaximus
Copy link
Contributor

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 :)

@nulledone
Copy link

Any updates on this? App's still not portable.

@rddim
Copy link
Contributor

rddim commented Jun 3, 2022

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.

@Gevaarlijk
Copy link

Is there an eta for the fix?

@MilesFarber
Copy link

So after 3 years, the portable version is still not portable.

@STPKITT
Copy link

STPKITT commented Jun 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Feature Requests
Medium Priority
Development

Successfully merging a pull request may close this issue.

8 participants