[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] win32-dir 0.1.0

djberg96

2/26/2005 12:36:00 AM

Hi all,

The Win32 Utils Team is happy to announce the first release of
win32-dir.

What is it?
===========
A series of extra constants for the Dir class that define special
folders on Win32 systems. That's it.

Like what?
==========
For example, if you want the "Windows" directory on your system, you
could do this:

require "win32/dir"
p Dir::WINDOWS

That could return C:\WINDOWS, C:\WINNT, or whatever you set it to when
you installed Windows. This is much easier than doing a bunch of
File.exists? checks.

Where is it?
============
It's available on the RAA, or on the Win32 Utils project page at
http://www.rubyforge.org/projects/....

Enjoy!

The Win32 Utils Team

5 Answers

Dave Burt

2/26/2005 5:51:00 AM

0

"Daniel Berger" <djberg96@hotmail.com> wrote:
> Hi all,
>
> The Win32 Utils Team is happy to announce the first release of
> win32-dir.
>
> What is it?
> ===========
> A series of extra constants for the Dir class that define special
> folders on Win32 systems. That's it.

It's possible to make symlinks to directories in Windows.

I know you can do it using a directory with a special name including a GUID
like this:
Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
This is a symlink to My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}

Sysinternals has a command-line tool to create and delete these:
http://www.sysinternals.com/ntw2k/source/misc.shtm...

Wouldn't the capability to make and inspect these be a neat addition to this
library?

Cheers,
Dave


djberg96

2/26/2005 7:00:00 AM

0

Daniel Berger wrote:
> Hi all,
>
> The Win32 Utils Team is happy to announce the first release of
> win32-dir.
>
> What is it?
> ===========
> A series of extra constants for the Dir class that define special
> folders on Win32 systems. That's it.
>
> Like what?
> ==========
> For example, if you want the "Windows" directory on your system, you
> could do this:
>
> require "win32/dir"
> p Dir::WINDOWS
>

Here's a bit more info in case that was too vague.

The list of constants (and a few examples):

Dir::ADMINTOOLS
Dir::COMMON_ADMINTOOLS
Dir::APPDATA
Dir::COMMON_APPDATA
Dir::COMMON_DOCUMENTS
Dir::COOKIES
Dir::HISTORY
Dir::INTERNET_CACHE
Dir::LOCAL_APPDATA
Dir::MYPICTURES
Dir::PERSONAL # Same as "My Documents"
Dir::PROGRAM_FILES # e.g. C:\Program Files
Dir::PROGRAM_FILES_COMMON
Dir::SYSTEM # e.g. C:\Windows\System32
Dir::WINDOWS

The following may or may not be defined on your system:

Dir::ALTSTARTUP
Dir::BITBUCKET
Dir::CDBURN_AREA
Dir::COMMON_ALTSTARTUP
Dir::COMMON_DESKTOPDIRECTORY
Dir::COMMON_FAVORITES
Dir::COMMON_MUSIC
Dir::COMMON_PICTURES
Dir::COMMON_PROGRAMS
Dir::COMMON_STARTMENU
Dir::COMMON_STARTUP
Dir::COMMON_TEMPLATES
Dir::COMMON_VIDEO
Dir::CONTROLS
Dir::DESKTOP
Dir::DESKTOPDIRECTORY
Dir::DRIVES
Dir::FAVORITES
Dir::FONTS # e.g. C:\WINDOWS\Fonts
Dir::INTERNET
Dir::MYDOCUMENTS
Dir::MYMUSIC
Dir::MYVIDEO
Dir::NETHOOD
Dir::NETWORK
Dir::PRINTERS
Dir::PRINTHOOD
Dir::PROFILE
Dir::PROFILES
Dir::PROGRAMS
Dir::RECENT
Dir::SENDTO
Dir::STARTMENU
Dir::STARTUP
Dir::TEMPLATES

Regards,

Dan

djberg96

2/26/2005 7:29:00 AM

0


Dave Burt wrote:
> "Daniel Berger" <djberg96@hotmail.com> wrote:
> > Hi all,
> >
> > The Win32 Utils Team is happy to announce the first release of
> > win32-dir.
> >
> > What is it?
> > ===========
> > A series of extra constants for the Dir class that define special
> > folders on Win32 systems. That's it.
>
> It's possible to make symlinks to directories in Windows.
>
> I know you can do it using a directory with a special name including
a GUID
> like this:
> Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
> This is a symlink to My
Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}
>
> Sysinternals has a command-line tool to create and delete these:
> http://www.sysinternals.com/ntw2k/source/misc.shtm...
>
> Wouldn't the capability to make and inspect these be a neat addition
to this
> library?
>
> Cheers,
> Dave

Thanks Dave. I'll take a look.

Regards,

Dan

Guillaume Marcais

2/28/2005 4:43:00 AM

0

Le 26 févr. 05, à 02:05, Daniel Berger a écrit :

To be even more basic, what would be the equivalent of the UNIX
"?/.my_app.rc"? File.join(Dir::APPDATA, "my_app.rc")?

Guillaume.


> Here's a bit more info in case that was too vague.
>
> The list of constants (and a few examples):
>
> Dir::ADMINTOOLS
> Dir::COMMON_ADMINTOOLS
> Dir::APPDATA
> Dir::COMMON_APPDATA
> Dir::COMMON_DOCUMENTS
> Dir::COOKIES
> Dir::HISTORY
> Dir::INTERNET_CACHE
> Dir::LOCAL_APPDATA
> Dir::MYPICTURES
> Dir::PERSONAL # Same as "My Documents"
> Dir::PROGRAM_FILES # e.g. C:\Program Files
> Dir::PROGRAM_FILES_COMMON
> Dir::SYSTEM # e.g. C:\Windows\System32
> Dir::WINDOWS
>
> The following may or may not be defined on your system:
>
> Dir::ALTSTARTUP
> Dir::BITBUCKET
> Dir::CDBURN_AREA
> Dir::COMMON_ALTSTARTUP
> Dir::COMMON_DESKTOPDIRECTORY
> Dir::COMMON_FAVORITES
> Dir::COMMON_MUSIC
> Dir::COMMON_PICTURES
> Dir::COMMON_PROGRAMS
> Dir::COMMON_STARTMENU
> Dir::COMMON_STARTUP
> Dir::COMMON_TEMPLATES
> Dir::COMMON_VIDEO
> Dir::CONTROLS
> Dir::DESKTOP
> Dir::DESKTOPDIRECTORY
> Dir::DRIVES
> Dir::FAVORITES
> Dir::FONTS # e.g. C:\WINDOWS\Fonts
> Dir::INTERNET
> Dir::MYDOCUMENTS
> Dir::MYMUSIC
> Dir::MYVIDEO
> Dir::NETHOOD
> Dir::NETWORK
> Dir::PRINTERS
> Dir::PRINTHOOD
> Dir::PROFILE
> Dir::PROFILES
> Dir::PROGRAMS
> Dir::RECENT
> Dir::SENDTO
> Dir::STARTMENU
> Dir::STARTUP
> Dir::TEMPLATES
>
> Regards,
>
> Dan
>
>




Dave Burt

2/28/2005 5:35:00 AM

0

"Guillaume Marcais" <guslist@free.fr> wrote in message:
> Le 26 févr. 05, à 02:05, Daniel Berger a écrit :
>
> To be even more basic, what would be the equivalent of the UNIX
> "?/.my_app.rc"? File.join(Dir::APPDATA, "my_app.rc")?

Some people use a dotfile:
File.join(Dir::PROFILE, ".irbrc")

Some people use a dotfile directory:
d = File.join(Dir::PROFILE, ".mysqlcc")
[File.join(d, 'mysqlcc.cfg'), File.join(d, 'history'), ...]

IMO, this is better:
d = File.join(Dir::APPDATA, "Application Name")

Or even:
d = File.join(Dir::APPDATA, "Vendor Name", "Application Name")

Cheers,
Dave