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

Reading config files from current dir for portable version #682

Closed
SumatraPeter opened this issue Apr 6, 2020 · 5 comments
Closed

Reading config files from current dir for portable version #682

SumatraPeter opened this issue Apr 6, 2020 · 5 comments

Comments

@SumatraPeter
Copy link

The main page states that under Windows the config files are read from either:

  • %USERPROFILE%\gallery-dl\config.json or
  • %USERPROFILE%\gallery-dl.conf

Can you also make it so that we can put config.json, gallery-dl.conf as well as any other config files the app reads in the same directory as the executable? I would like a completely portable copy and don't want to place my config files in %USERPROFILE% on every machine I run the app on.

@iamleot
Copy link
Contributor

iamleot commented Apr 6, 2020 via email

@Hrxn
Copy link
Contributor

Hrxn commented Apr 7, 2020

(I'm completely unfamiliar with Windows but at least on Unix systems
looking for config.json or gallery-dl.conf in the same directory where
gallery-dl' is installed (e.g. /usr/local/bin') would be probably a
bit weird.)

Yes, exactly.

If you really want to do something completely portable, use the command-line option to specify a config file (see comment above). This is very easy to do if you simply call gallery-dl from your own script (so, on Windows, either .cmd or .bat for good old CMD, or .ps1 for PowerShell), and then you can put your own script file into a single directory with the binary file and the config file etc.

And just for fun, in your own script you can also do stuff like simply move the config file into %USERPROFILE%, invoke gallery-dl, and then just move the file back. Or just change the value of %USERPROFILE% ad-hoc. The possibilities are endless 😏

@SumatraPeter
Copy link
Author

SumatraPeter commented Apr 7, 2020

@Hrxn: Nah, not gonna move files into %USERPROFILE% of systems I plug my USB drive into. Far too easy to have things abort and leave behind trash. As for changing the value of the envar itself, doesn't seem like a good idea (at least not when -c is available).

@iamleot: Wouldn't be weird for Windows programs in the least, especially if they support portable usage (most stand-alone command-line apps do). Thanks for the tip about -c though - that's useful!

@mikf: -c is nice but if you can make the app also scan the current dir for its config files (even if only on Windows) then that'll be great.

Also, to be perfectly honest %USERPROFILE%\gallery-dl and %USERPROFILE% aren't where app-specific settings should be stored in any case. I don't know if you just tried to replicate how it's done on Unix/Linux, but in Windows the proper location would be %APPDATA%\gallery-dl.

@SumatraPeter
Copy link
Author

SumatraPeter commented Apr 8, 2020

Thanks @mikf!

@github-account1111
Copy link

github-account1111 commented Jul 9, 2020

But even when I use the -c option, there's still a gallery-dl folder with a cache.sqlite3 file in AppData\Roaming which gets recreated every time I run gallery-dl. Anything to take care of that?

Edit I think I fixed this by putting the following in the topmost level of gallery-dl.conf:

"cache": {
  "file": "./gallery_dl_cache.sqlite3"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants