[ANN] win32-dir 0.1.0

D

Daniel Berger

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/win32utils.

Enjoy!

The Win32 Utils Team
 
D

Dave Burt

Daniel Berger said:
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.shtml#junction

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

Cheers,
Dave
 
D

Daniel Berger

Daniel said:
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
 
D

Daniel Berger

Dave said:
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.shtml#junction

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
 
G

Guillaume Marcais

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

Dave Burt

Guillaume Marcais said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top