[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Platform independant getpwnam?

gga

3/8/2005 9:28:00 PM


On linux:
require 'etc'
uid = Etc::getpwnam(username).uid

this works fine, but on windows, this fails miserably. Is there a
platform independent way of getting the uid for any username (so as to
later use that uid against File::Stat.uid)?

1 Answer

djberg96

3/8/2005 9:54:00 PM

0

gga wrote:
> On linux:
> require 'etc'
> uid = Etc::getpwnam(username).uid
>
> this works fine, but on windows, this fails miserably. Is there a
> platform independent way of getting the uid for any username (so as
to
> later use that uid against File::Stat.uid)?

require "win32/etc"
include Win32

uid = Etc.getpwnam(username).uid

Regards,

Dan

PS - Keep an eye out for the sys-admin package, coming soon.
PS2 - I plan on redefining File.stat in the win32-file package.