[Rubygems-developers] Remote Installer Progress

Jim Weirich jim at weirichhouse.org
Fri Dec 3 11:55:34 EST 2004


Hugh Sasse Staff Elec Eng said:

>> So that's what I was asking, is a file name (not extension) ".gem"
>> too weird for windows users?
>>
> So I think the answer to that is "It should be fine."  But it's
> proprietry, so Windows may well do whatever it likes :-)

I'm at work now and can check a windows machine.  I looked in the
directory specified by %USERPROFILE% and found numerous files and
directories beginning with a "." dot.  Most were from programs developed
originally on unix systems but the precedent is there.

BTW, I use the following algorithm to determine a home directory.  This
probably fails on older windows systems that don't set USERFPROFILE,
HOMEDRIVE or HOMEPATH.  And expanding "~" fails on anything without HOME
defined, so I need a better "last resort".  Suggestions welcome.

    def find_home
      ['HOME', 'USERPROFILE'].each do |homekey|
	return ENV[homekey] if ENV[homekey]
      end
      if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
	return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
      end
      File.expand_path("~")
    end


-- 
-- Jim Weirich     jim at weirichhouse.org    http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



More information about the Rubygems-developers mailing list