The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Adding constants to Dir

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Adding constants to Dir Posted: Feb 25, 2005 8:52 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Adding constants to Dir
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
I released win32-dir tonight. This was a simple package - it's just a bunch of Windows specific constants added to the Dir class. So, if you need to get to the hosts file you can do something like this:
require "win32/dir"

hosts_file = Dir::WINDOWS + '\system32\drivers\etc\hosts'

Where Dir::WINDOWS could be 'C:\WINDOWS' or 'C:\WINNT' or whatever it was set to when the OS was installed. This is quite a bit easier than doing a bunch of File.exists? checks, eh?

Read: Adding constants to Dir

Topic: Soo many quotes, so little space Previous Topic   Next Topic Topic: Avoiding the Second System Effect

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use