View mode: basic / threaded / horizontal-split · Log in · Help
June 20, 2007
What I do to easily switch between different DMD versions and libraries on Windows
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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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!
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
"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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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
June 20, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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.
June 21, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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.
June 21, 2007
Re: What I do to easily switch between different DMD versions and libraries on Windows
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
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home