Support for environment variables in folder paths?

First of all, I am not sure whether this is a bug or by design, hence the topic on the forum, and not on GitHub.

When setting a folder path to something like %UserProfile%\Sync (on Windows), Syncthing will literally create a folder called %UserProfile% and Sync inside of it, instead of expanding the %UserProfile% variable to C:\Users\User or similar.

Is this the way this is supposed to work? If not, what do you think of allowing to use environment variables in this situation?

1 Like

Yes, we do not interpret environment variables. And I don’t think we want to, as it’s whole class of validation we’d have to handle.

To believe only Windows specific applications, such as explorer/cmd handle these things correctly.

It’s unusual for applications to handle these things, unless they use win32 api folder selection dialogs or things alike.

These variables are usually static anyway.

Understood.

Hmm, I have not done any specific testing, thus cannot give numbers, but programs like KeePass, for instance, do allow using environment variables when specifying location of databases, etc., and these are not folder selection dialogs, or anything like that.

I don’t doubt that there will be applications that support it, but that doesn’t necessarily make a strong argument why it’s important to support it in syncthing.

We support one variable, ~, the meaning of which you can influence with environment variables…