From: itsme213 Date: 2005-04-12T13:14:38+09:00 Subject: Re: [ANN] cmd 0.7.0: Library for Line-Oriented Command Interpreters (initial release) thanks, i just declared a HOME env-var and it worked fine. "Marcel Molina Jr." wrote in message news:20050412035114.GJ31062@simons-rock.edu... > On Tue, Apr 12, 2005 at 12:29:38PM +0900, itsme213 wrote: > > "Marcel Molina Jr." wrote in message > > news:20050410202623.GR31062@simons-rock.edu... > > > = Cmd 0.7.0 (initial release) > > > > Gem install, Windows XP, Ruby 1.8.2, trying out phonebook.rb, I get: > > > > [C:\ruby\lib\ruby\gems\1.8\gems\cmd-0.7.2\example]ruby phonebook.rb > > phonebook.rb:11:in `expand_path': couldn't find HOME environment -- > > expanding `~/.pho > > nebook' (ArgumentError) > > from phonebook.rb:11 > > Yes, I was fairly certain when I wrote that that it would not work on > Windows. The phonebook.rb example is meant to be simple and illustrative so > I passed over my recognition that I was more than likely imposing a platform > dependency. A bit insensitive, sorry 'bout that :) > > Thanks for reporting this. Just for kicks I've made phonebook.rb a bit more > platform agnostic. Mind you I don't have access to a Windows machine to test > this but it *seems* like it ought to cover most cases. > > PHONEBOOK_FILE = begin > File.expand_path('~/.phonebook') > rescue > File.join((ENV['HOME'] || ENV['USERPROFILE']), '_phonebook') > end > > Windows users that I asked knew many ways in which this could be made more > rigorous or "accurate" or what have you but for the purposes of the > phonebook example I'm assuming this will work well enough. > > Thanks again. Please let me know if you implement something with cmd and > thanks for the interest.