RichiH / vcsh

config manager based on Git
GNU General Public License v2.0
2.2k stars 124 forks source link

Question: Storing repository in different location based on OS? #132

Open nfarrar opened 10 years ago

nfarrar commented 10 years ago

I'm trying to come up with a solution for using my sublime text 3 configuration both on windows (vcsh via cygwin) and debian.

On debian it's stored in $HOME/.config/sublime-text-3/Packages/User and on windows its stored in $HOME/.AppData/Roaming/Sublime\ Text\ 3/Packages/User

Right now I have the the files checked into git at the debian path, if I check it out in cygwin ... I could symlink it into place (not a good solution) ... Or potentially remove all the files and check them in at the root of the git repository, then when I use vcsh, set VCSH_BASE to the OS specific path.

Any ideas?

RichiH commented 10 years ago

The first bit is trivial:

Set $XDG_CONFIG_HOME to $HOME/.AppData/Roaming/ on Windows.

The fact that sublime-text-3 and Sublime Text 3 are used is... nasty. Is linking on the local file system an option for you? As an alternative, you could look into smudge filters, but that becomes messy real quick.

dhj-io commented 9 years ago

I know this is late, but thought it might help others trying to consolidate linux and win configurations. I was working through this with msysgit and found that directory junctions on windows seem to work very well. They essentially act as symlinks for directories across drives. All of my installed msys programs work correctly with them so far.

To create a directory junction use this in windows cmd: mklink /j <target> <source>. Note target and source are switched from a linux ln -s command. Your solution would be (from windows cmd prompt):

cd %HOME%
mkdir .config
cd .config
mklink /j sublime-text-3 "%HOME%\AppData\Roaming\Sublime Text 3"

All of the files accessed with vcsh (or mr or git etc) through $HOME/.config/sublime-text-3 will then modify files in the AppData directory. In this example .config is a real directory and sublime-text-3 is a directory junction.