Using SymLinks under Windows.

News and discussion of the PC port of Oolite.

Moderators: another_commander, winston

Post Reply
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Using SymLinks under Windows.

Post 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.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Using SymLinks under Windows.

Post 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..
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Using SymLinks under Windows.

Post 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.

[Wikipedia] More details here.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Using SymLinks under Windows.

Post 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.

[Wikipedia] More details here.
Cool.. good to know.. thanks!

Edit: others should note, Windows symlinks only work on Vista, Win7 and Win8.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: Using SymLinks under Windows.

Post 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.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Using SymLinks under Windows.

Post 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.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: Using SymLinks under Windows.

Post 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.
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Using SymLinks under Windows.

Post 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.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Using SymLinks under Windows.

Post 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.
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Using SymLinks under Windows.

Post 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:
Image

[I know it's a mess, I'll clean it up when I re-install my PC some time in the future.]
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Using SymLinks under Windows.

Post by Diziet Sma »

Gimi wrote:
I have:
Image

[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?
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Using SymLinks under Windows.

Post 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.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Using SymLinks under Windows.

Post 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 
User avatar
spud42
---- E L I T E ----
---- E L I T E ----
Posts: 1565
Joined: Wed Mar 26, 2014 10:11 am
Location: Brisbane,Australia

Re: Using SymLinks under Windows.

Post 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?
Arthur: OK. Leave this to me. I'm British. I know how to queue.
OR i could go with
Arthur Dent: I always said there was something fundamentally wrong with the universe.
or simply
42
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Using SymLinks under Windows.

Post 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.
Post Reply