oleg-shilo / Favorites.vscode

VSCode extension for managing Favorites
MIT License
23 stars 6 forks source link

Cross-platform usage #8

Closed mbaas2 closed 5 years ago

mbaas2 commented 5 years ago

(Disclaimer: I am not sure if this a real issue of Favorites or if I am abusing it or perpahsp just don't know it well enough - so pls. forgive me if the latter should be the case. Would appreciate a few hints in that case ;-))

I have similiar folder-structures for my favs on my Windows-machine and on my Linux-box. Where Win says C:\,Git Linux just uses /Git and all is well. I suppose I could address that with appropriate env-vars. So I would like to use the same Favs on all platforms.

But I hit a problem with %AppData%Roaming\Code\User\favorites.user\config.json which has a full path to the current list. I tried to replace that full path with "./" which worked. Once - but as soon as the favs were loaded, that path was changed back to a full path - which defeats the purpose I was looking for. So I tried to use EnvVars there - (hoping $ might be a cross-platform-vs-way of using them), but that didn't work either. Is it possible to somehow make that a relative path or use envVars (on Win, *nix and Mac)?

oleg-shilo commented 5 years ago

I am not entirely sure about what you are trying to achieve bu you can definitely have envars in your favorite list content:

# The content below is just a Favorites list sample
$CSSCRIPT_DIR/cscs.runtimeconfig.json

image

mbaas2 commented 5 years ago

It seems I can't specify the path to the list-files with my favs in a cross-platform way. The file blabla\User\favorites.user\config.json has an absolut path with C:\ in it. That will not work on Linux or Mac. So I tried to replace that absolute path with a relative path "./foo.list.txt", but after loading that path was replaced with the absolute path.

oleg-shilo commented 5 years ago

So I tried to replace that absolute path with a relative path "./foo.list.txt"...

OK I see now what you mean. Though it is a very little benefit for the extension to store the fav-list file name instead of the path I don't see any particular harm in it.

Done.

image

mbaas2 commented 5 years ago

Great, thanks very much!

lonix1 commented 2 years ago

I can confirm that env vars works on linux too. I use $HOME/foo/bar.txt successfuly (note that must be used instead of ~/foo/bar.txt).