Persist rclone.conf for rclone
According to the document, "If there is a file rclone.conf in the same directory as the rclone executable it will be preferred". Suggest to add persist for this file for portability.
"persist": "rclone.conf"
To note, when I tried doing this, both with creating a blank file and with writing dummy content with pre_install, the file appears to unlink after modifying it using rclone config.
In the image below, I seeded the file with
# Generated by scoop
[]
as a test. Generally, I do not recommend adding [] as it confuses rclone. This was very much a test.
The files initially were the same and stayed linked when edited from Notepad, however the modiifications from rclone config broke the link between the files:

Seeding with other data, or with no data at all, has the same result.
The json additions used to test this were
"pre_install": [
"if (!(Test-Path \"$persist_dir\\rclone.conf\")) {",
" Set-Content \"$dir\\rclone.conf\" \"# Generated by scoop\n[]\" -Encoding Ascii",
"}"
],
"persist": "rclone.conf",
Or without seeding data:
"pre_install": [
"if (!(Test-Path \"$persist_dir\\rclone.conf\")) {",
" New-Item \"$dir\\rclone.conf\" -ItemType File | Out-Null",
"}"
],
"persist": "rclone.conf",
One could, possibly, copy the file into the persist folder on uninstall/update of the app, however I do not know if that is the "best practise" or how well it will survive various scenarios.
Oh, it's one of those. I recently just dealt with one of them: XnView MP: https://github.com/ScoopInstaller/Extras/commit/e1bdec038bd3f8b7da96a91dbb8e41cf47689f51#diff-885f1363c5c6441c79783e04e79bc342d07d2e288342af52a3fef6d01fc27853
There is no need to have persist then. Just New-Item a blank file.
Imagine one day Scoop could allow maintainers to create symbolic link instead of hard link...
Possibly off-topic for the issue but trying to understand it to emulate for rclone, the code in that commit doesn't seem to work correctly if the persist dir doesn't exist before installing the app. I noticed it when trying to use it for rclone.
Uninstall creates an extensionless file in persist containing the ini files data:
But it isn't picked back up on install, because it's expecting that to be a folder with the ini inside of it.
I pretty much copied this for rclone to test:
"pre_install": [
"if (Test-Path \"$persist_dir\\rclone.conf\") {",
" Copy-Item \"$persist_dir\\rclone.conf\" \"$dir\"",
"} else {",
" New-Item \"$dir\\rclone.conf\" | Out-Null",
"}"
],
"uninstaller": {
"script": "Copy-Item \"$dir\\rclone.conf\" \"$persist_dir\" -Force"
},
And the exact same issue plays out.
I tried to circumvent it with
"uninstaller": {
"script": "Copy-Item \"$dir\\rclone.conf\" \"$persist_dir\\rclone.conf\" -Force"
},
(Addition of \\rclone.conf after $persist_dir)
Which looks like it may have worked if the persist dir was created beforehand, because it returns
PS C:\Users\Erisa\Work\Main> scoop uninstall rclone
Uninstalling 'rclone' (1.56.2).
Running uninstaller script...
Copy-Item: Could not find a part of the path 'C:\Users\Erisa\scoop\persist\rclone\rclone.conf'.
Removing shim for 'rclone'.
Unlinking ~\scoop\apps\rclone\current
'rclone' was uninstalled.
Thank you Erisa. I revised my approach at https://github.com/ScoopInstaller/Extras/pull/7199. Feel free to try that code. If you can confirm it's working, I don't mind creating a PR for this issue.
@CrendKing are you working on a fix for rclone?
Was waiting for some response. I'll create a PR later.
Hey, sorry for not responding. PR looks good
Hi Guys, Sorry I'm bit late but this change break the support of the existing configuration as describe here : https://rclone.org/docs/#config-config-file
Rclone will look for an existing configuration file in any of the following locations, in priority order:
1. rclone.conf (in program directory, where rclone executable is)
2. %APPDATA%/rclone/rclone.conf (only on Windows)
3. $XDG_CONFIG_HOME/rclone/rclone.conf (on all systems, including Windows)
4. ~/.config/rclone/rclone.conf (see below for explanation of ~ symbol)
5. ~/.rclone.conf
Indeed, as the rclone.conf persist now, only the first options is considered by default/priority
My last update has broke my existing configuration, now I need to pass the --config flags each time....
Sounds like maybe we should only be persisting that file if it gets created by the application (Not having any other configs and then adding a remote from scratch) rather than forcing it to exist on each install?
And @PeeZu you can temporarily work around this until the next version by deleting scoop/apps/rclone/current/rclone.conf