Page 1 of 1
Using SymLinks under Windows.
Posted: Wed Oct 09, 2013 10:39 pm
by Gimi
I have been looking at a solution for some small annoyances I have been having with my Oolite installations under Windows.
-When testing different versions of Oolite I want to be able to use the same set of AddOns and save games without moving or copying the folders around.
-When I want to compile a different branch of Oolite and do a make clean prior to compiling, I want my save files and AddOns folder to be left intact.
Well, it turns out that you can use SymLinks under windows, and this seems to solve these problems. (You might know about this, but this is news to me)
It's a command line tool called MKLINK under Windows that is included with all versions of Windows starting with Vista, and it works with NTFS only.
If you don't want to use the command line there are some nice tools around that provides you with a simple GUI.
http://code.google.com/p/symlinker/ This one seems to be the most user friendly.
http://sourceforge.net/projects/symlink-creator/ More functionality, but also a bit more complex.
Use this to create SymLink folders that points to your save game folder and your AddOns folder and suddenly you can have several versions of Oolite sharing the same AddOns folder and you can keep you addons and save games in a different location, e.g safe when doing a make clean before compiling.
Disclaimer: I have tested this briefly and it seems to work fine, but no guarantees are given. Remember to keep a backup just in case something goes wrong.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 6:34 am
by Diziet Sma
So are these different than the standard 'shortcuts' that Windows has had for years? I always just right-clicked the item in question, selected "Create shortcut', then moved the shortcut to wherever I wanted it located and renamed it as required..
Will have to have a play with my Virtual installs of XP and Win7 when I get a chance..
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 6:42 am
by Gimi
Diziet Sma wrote:So are these different than the standard 'shortcuts' that Windows has had for years? I always just right-clicked the item in question, selected "Create shortcut', then moved the shortcut to wherever I wanted it located and renamed it as required..
Will have to have a play with my Virtual installs of XP and Win7 when I get a chance..
Yes, they are different from a standard shortcut.
Essentially they behave as POSIX Symlinks, and were introduced on Windows to aid application compatibility with POSIX operating systems.
More details here.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 8:07 am
by Diziet Sma
Gimi wrote:Yes, they are different from a standard shortcut.
Essentially they behave as POSIX Symlinks, and were introduced on Windows to aid application compatibility with POSIX operating systems.
More details here.
Cool.. good to know.. thanks!
Edit: others should note, Windows symlinks only work on Vista, Win7 and Win8.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 9:05 am
by JazHaz
Interesting. I used to have SymLinks on my old Atari Falcon setup, very useful when I had to split a large hard drive into a lot of partitions (the only way to use a large HD on the Atari). I would use the SymLinks to knit it all back together lol.
SymLinks under Windows could be useful if you have a network server, and use a few computers attached to it over a wifi network. Imagine, you could host your AddOns on the server, and SymLink it to your Oolite installations on different computers.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 9:38 am
by Diziet Sma
JazHaz wrote:SymLinks under Windows could be useful if you have a network server, and use a few computers attached to it over a wifi network. Imagine, you could host your AddOns on the server, and SymLink it to your Oolite installations on different computers.
You could do the same with your game saves.. have them accessible from any machine.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 12:05 pm
by JazHaz
I just thought that the SymLinks could well be of use with
testing the 64-bit version of Oolite, so that I can use the same saved games instead of a copy. Now how do I create them again...? ...(looks at the first post)...
EDIT: tried this idea out, but Oolite couldn't find the Saved Games folder. I had to navigate normally using the Ctrl buttons to move between folders.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 1:19 pm
by Gimi
JazHaz wrote:I just thought that the SymLinks could well be of use with
testing the 64-bit version of Oolite, so that I can use the same saved games instead of a copy. Now how do I create them again...? ...(looks at the first post)...
EDIT: tried this idea out, but Oolite couldn't find the Saved Games folder. I had to navigate normally using the Ctrl buttons to move between folders.
I did this and it works fine.
I have moved my AddOns and oolite-saves folders to a separate directory and created symlink folders in the oolite installations.
You have to have administrator access to create the links, so you have to run cmd.exe, or if you are using the tools I linked to, as administrator.
Re: Using SymLinks under Windows.
Posted: Thu Oct 10, 2013 11:54 pm
by Tricky
Just tested this with Cygwin and it understands the symlinks created with MKLINK but Windows doesn't understand symlinks created with Cygwin.
One other thing. Do the snapshots get placed in the Windows symlink'd oolite-save directory or do they get placed in oolite.app\oolite-saves\snapshots
directory of the different builds?
I know I can direct Oolite to look in one directory for all builds for the save files by using the save-directory
entry in .GNUstepDefaults but the snapshots always get placed in the separate build directories.
Re: Using SymLinks under Windows.
Posted: Fri Oct 11, 2013 8:27 am
by Gimi
Tricky wrote:Just tested this with Cygwin and it understands the symlinks created with MKLINK but Windows doesn't understand symlinks created with Cygwin.
One other thing. Do the snapshots get placed in the Windows symlink'd oolite-save directory or do they get placed in oolite.app\oolite-saves\snapshots
directory of the different builds?
I know I can direct Oolite to look in one directory for all builds for the save files by using the save-directory
entry in .GNUstepDefaults but the snapshots always get placed in the separate build directories.
All my snapshots are placed in the "Windows symlink'd oolite-save directory" the way I have it set up.
I have:
[I know it's a mess, I'll clean it up when I re-install my PC some time in the future.]
Re: Using SymLinks under Windows.
Posted: Wed Feb 19, 2014 4:06 am
by Diziet Sma
Gimi wrote:I have:
[I know it's a mess, I'll clean it up when I re-install my PC some time in the future.]
Hey Gimi.. did you tidy this up, yet?
Re: Using SymLinks under Windows.
Posted: Wed Feb 19, 2014 7:22 am
by Gimi
Diziet Sma wrote:Gimi wrote:[I know it's a mess, I'll clean it up when I re-install my PC some time in the future.]
Hey Gimi.. did you tidy this up, yet?
I did, but I haven't reimplemented the Symlinks. Their behaviour is not quite consistent so, while everything works fine from within Oolite, there is some strange behaviour that I don't like/understand from the Windows side. It's been a while since I played around with it though.
I think I'm going to ask cim to implement an additional and configurable location for OXP's and a clean command that leaves AddOns alone. The first one should be particularly convenient for OXP developers.
Re: Using SymLinks under Windows.
Posted: Thu May 22, 2014 10:18 am
by Norby
spud42 wrote:I have heard of symlinks before but never used them. any chance of a quick how to?
Under Windows click on start menu/run then type cmd and enter to get a command prompt in a black window, where you can type something like this (please chage the directory names to point where your files are):
Code: Select all
mklink /D /J c:\Users\Norby\Dropbox\oolite-saves c:\Oolite\oolite.app\oolite-saves
To get automatic backup you must install a software from your hosting service which run in the background and copy files at every changes from the directory mentioned first after mklink into your hosting space.
Under Linux:
Code: Select all
ln -s /home/Norby/oolite-saves /home/Norby/Dropbox/oolite-saves
Re: Using SymLinks under Windows.
Posted: Thu May 22, 2014 12:49 pm
by spud42
Norby wrote:spud42 wrote:I have heard of symlinks before but never used them. any chance of a quick how to?
Under Windows click on start menu/run then type cmd and enter to get a command prompt in a black window, where you can type something like this (please chage the directory names to point where your files are):
Code: Select all
mklink /D /J c:\Users\Norby\Dropbox\oolite-saves c:\Oolite\oolite.app\oolite-saves
To get automatic backup you must install a software from your hosting service which run in the background and copy files at every changes from the directory mentioned first after mklink into your hosting space.
Under Linux:
Code: Select all
ln -s /home/Norby/oolite-saves /home/Norby/Dropbox/oolite-saves
thanks Norby, i did google it after i wrote that but still was not sure. what do you do with the original saver folder? does this automatically move the contents to the linked folder or do i have to do that manually? if so before or after i make the symlink?
Re: Using SymLinks under Windows.
Posted: Thu May 22, 2014 1:30 pm
by Norby
You do not need to touch the original folder. Symlinks are not real folders but pointers to another folder. If you make a pointer within your backup folder by the previous howto then the background software will follow the link and copy all files from the original directory into the host server.