Platform independant getpwnam?

G

gga

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)?
 
D

Daniel Berger

gga said:
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.
 

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

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top