www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What I do to easily switch between different DMD versions and

reply "Anders Bergh" <anders1 gmail.com> writes:
Since there are now two D versions, I figured some of you might be
interested in the trick I use on Windows to switch between compilers
easily.

I have DMD 1.016 (Phobos), DMD 1.014 (Tango) and DMD 2.000. Switching
between versions is only two clicks away.



Things you will need:

1. Windows 2000 or above.

2. NTFS file system.

3. http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
This tool lets you create directory symlinks (NTFS junctions).

1. Extract "junction.exe" into your PATH, I simply extracted it into C:\Windows.

2. Extract dmd 1.x into c:\dmd1_phobos.

3. Extract dmd 2.x into c:\dmd2_phobos.

4. Open notepad, copy/paste this into a new file, "dmd1_phobos.bat":

 echo off
rem Deletes the current symlink and replaces it with a new one.
junction -d c:\dmd
junction c:\dmd c:\dmd1_phobos

5. Do the same for your other DMD installations, just replace
"c:\dmd1_phobos" with "c:\dmd2_phobos", etc.


To change between DMD versions, simply double click the corresponding
batch file. The location of the batch files does not matter.

I hope this helps someone out there, it sure did make things easier
for me when playing around with Tango and 2.0 :-)

-- 
Anders
Jun 20 2007
next sibling parent Max Samukha <samukha voliacable.com.removethis> writes:
On Wed, 20 Jun 2007 12:45:30 +0200, "Anders Bergh" <anders1 gmail.com>
wrote:

Since there are now two D versions, I figured some of you might be
interested in the trick I use on Windows to switch between compilers
easily.

I have DMD 1.016 (Phobos), DMD 1.014 (Tango) and DMD 2.000. Switching
between versions is only two clicks away.



Things you will need:

1. Windows 2000 or above.

2. NTFS file system.

3. http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
This tool lets you create directory symlinks (NTFS junctions).

1. Extract "junction.exe" into your PATH, I simply extracted it into C:\Windows.

2. Extract dmd 1.x into c:\dmd1_phobos.

3. Extract dmd 2.x into c:\dmd2_phobos.

4. Open notepad, copy/paste this into a new file, "dmd1_phobos.bat":

 echo off
rem Deletes the current symlink and replaces it with a new one.
junction -d c:\dmd
junction c:\dmd c:\dmd1_phobos

5. Do the same for your other DMD installations, just replace
"c:\dmd1_phobos" with "c:\dmd2_phobos", etc.


To change between DMD versions, simply double click the corresponding
batch file. The location of the batch files does not matter.

I hope this helps someone out there, it sure did make things easier
for me when playing around with Tango and 2.0 :-)
Very useful info. Thanks!
Jun 20 2007
prev sibling next sibling parent reply Henning Hasemann <hhasemann web.de> writes:
"Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
+0200):

 http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning -- GPG Public Key: http://keyserver.ganneff.de:11371/pks/lookup?op=get&search=0xDDD6D36D41911851 Fingerprint: 344F 4072 F038 BB9E B35D E6AB DDD6 D36D 4191 1851
Jun 20 2007
parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
Henning Hasemann wrote:
 "Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
 +0200):
 
 http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning
They aren't. You need to be very careful with junctions. Firstly, if you delete a junction directly, you will delete the original folder as well! To make this worse, there is no way to tell from explorer if a folder is a junction or not. Anders' trick is still cool, but just be very careful with it. MS didn't write a tool to create junctions for a very good reason :) -- Daniel
Jun 20 2007
parent reply Don Clugston <dac nospam.com.au> writes:
Daniel Keep wrote:
 
 Henning Hasemann wrote:
 "Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
 +0200):

 http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning
They aren't. You need to be very careful with junctions. Firstly, if you delete a junction directly, you will delete the original folder as well! To make this worse, there is no way to tell from explorer if a folder is a junction or not.
A solution to this would be to change the icon while making the junction. Anyone changed a folder icon before? Probably just an API call to set file attributes.
 Anders' trick is still cool, but just be very careful with it.  MS
 didn't write a tool to create junctions for a very good reason :)
 
 	-- Daniel
Jun 20 2007
next sibling parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Don Clugston wrote:

 Daniel Keep wrote:
 
 Henning Hasemann wrote:
 "Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
 +0200):

 http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning
They aren't. You need to be very careful with junctions. Firstly, if you delete a junction directly, you will delete the original folder as well! To make this worse, there is no way to tell from explorer if a folder is a junction or not.
A solution to this would be to change the icon while making the junction. Anyone changed a folder icon before? Probably just an API call to set file attributes.
 Anders' trick is still cool, but just be very careful with it.  MS
 didn't write a tool to create junctions for a very good reason :)
 
 -- Daniel
Back when I used Windows I used this shell extension which allows you to manage links and junctions from explorer, and it changes the icons. Very handy! -Tomas
Jun 20 2007
next sibling parent Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Tomas Lindquist Olsen wrote:

 Don Clugston wrote:
 
 Daniel Keep wrote:
 
 Henning Hasemann wrote:
 "Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
 +0200):


http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning
They aren't. You need to be very careful with junctions. Firstly, if you delete a junction directly, you will delete the original folder as well! To make this worse, there is no way to tell from explorer if a folder is a junction or not.
A solution to this would be to change the icon while making the junction. Anyone changed a folder icon before? Probably just an API call to set file attributes.
 Anders' trick is still cool, but just be very careful with it.  MS
 didn't write a tool to create junctions for a very good reason :)
 
 -- Daniel
Back when I used Windows I used this shell extension which allows you to manage links and junctions from explorer, and it changes the icons. Very handy! -Tomas
oups... http://www.paraesthesia.com/blog/comments.php?id=801_0_1_0_C
Jun 20 2007
prev sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
Tomas Lindquist Olsen wrote:
 Don Clugston wrote:
 
 Daniel Keep wrote:
 Henning Hasemann wrote:
 "Anders Bergh" <anders1 gmail.com> schrieb (Wed, 20 Jun 2007 12:45:30
 +0200):

 http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
Cool I didnt know Windows has "already" something that comes close to "real" symlinks. Henning
They aren't. You need to be very careful with junctions. Firstly, if you delete a junction directly, you will delete the original folder as well! To make this worse, there is no way to tell from explorer if a folder is a junction or not.
A solution to this would be to change the icon while making the junction. Anyone changed a folder icon before? Probably just an API call to set file attributes.
 Anders' trick is still cool, but just be very careful with it.  MS
 didn't write a tool to create junctions for a very good reason :)

 -- Daniel
Back when I used Windows I used this shell extension which allows you to manage links and junctions from explorer, and it changes the icons. Very handy! -Tomas
For working with junction points (folders) and hard links (file) in Windows I recommend NTFS Link: http://sourceforge.net/projects/ntfslinkext It's an extension to file explorer with many features, like junction icon (green arrow), hard link icon (yellow arrow), deletion detection, explorer creation, unlink, link target viewing, etc. . -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Jun 21 2007
prev sibling parent Daniel Keep <daniel.keep.lists gmail.com> writes:
Don Clugston wrote:
 A solution to this would be to change the icon while making the junction.
 Anyone changed a folder icon before? Probably just an API call to set
 file attributes.
IIRC: you need to create an attrib +hs file[1] called Desktop.ini with something like this in it: [.ShellClassInfo] IconFile=C:\Path\to\the.ico IconIndex=0 Then you need to make sure the folder itself is just +r. Then somehow get Explorer to flush the icon cache. -- Daniel [1] Also make sure you remove the archive attribute, since this seems to stuff it up.
Jun 20 2007
prev sibling parent reply Don Clugston <dac nospam.com.au> writes:
Anders Bergh wrote:
 Since there are now two D versions, I figured some of you might be
 interested in the trick I use on Windows to switch between compilers
 easily.
 
 I have DMD 1.016 (Phobos), DMD 1.014 (Tango) and DMD 2.000. Switching
 between versions is only two clicks away.
 
 
 
 Things you will need:
 
 1. Windows 2000 or above.
 
 2. NTFS file system.
 
 3. http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx
 This tool lets you create directory symlinks (NTFS junctions).
 
 1. Extract "junction.exe" into your PATH, I simply extracted it into 
 C:\Windows.
 
 2. Extract dmd 1.x into c:\dmd1_phobos.
 
 3. Extract dmd 2.x into c:\dmd2_phobos.
 
 4. Open notepad, copy/paste this into a new file, "dmd1_phobos.bat":
 
  echo off
 rem Deletes the current symlink and replaces it with a new one.
 junction -d c:\dmd
 junction c:\dmd c:\dmd1_phobos
 
 5. Do the same for your other DMD installations, just replace
 "c:\dmd1_phobos" with "c:\dmd2_phobos", etc.
 
 
 To change between DMD versions, simply double click the corresponding
 batch file. The location of the batch files does not matter.
 
 I hope this helps someone out there, it sure did make things easier
 for me when playing around with Tango and 2.0 :-)
Great! But is it necessary to delete the old symlink? It seems to work fine if you don't. Then, the first time after you run one of your batch files, you can go into explorer and give the 'c:\dmd' folder a funny icon, or set its hidden attribute. This greatly reduces the chance of inadvertently deleting it, and creating havoc, as Daniel described.
Jun 21 2007
parent "Anders Bergh" <anders1 gmail.com> writes:
On 6/21/07, Don Clugston <dac nospam.com.au> wrote:
 Great! But is it necessary to delete the old symlink? It seems to work fine if
 you don't.
 Then, the first time after you run one of your batch files, you can go into
 explorer and give the 'c:\dmd' folder a funny icon, or set its hidden
attribute.
 This greatly reduces the chance of inadvertently deleting it, and creating
 havoc, as Daniel described.
I only deleted the old symlink just in case... if it works without it that's cool. Wouldn't setting an icon for c:\dmd affect c:\dmdX_XXX as well? As far as I know it just places a desktop.ini in the directory that points to an icon. -- Anders
Jun 21 2007