Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Platform independant getpwnam?

Reply
Thread Tools

Platform independant getpwnam?

 
 
gga
Guest
Posts: n/a
 
      03-08-2005

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

 
Reply With Quote
 
 
 
 
Daniel Berger
Guest
Posts: n/a
 
      03-08-2005
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Compiler program platform-independant? Lew Java 19 01-11-2011 10:21 AM
Is Winxp independant of Dos? =?Utf-8?B?VGF0dA==?= Microsoft Certification 11 04-09-2006 03:53 PM
some kinds of independant ads get thru Firefox 1.5 gregfarr Firefox 2 03-17-2006 12:31 PM
independant access point =?Utf-8?B?Q2hyaXN0b3BoZXIgQnV4dG9u?= Wireless Networking 2 12-08-2005 03:23 PM
Hardware specs gathering? - platform independant Nicky Kotze Python 2 03-02-2005 01:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57