ryanb / ruby-warrior

Game written in Ruby for learning Ruby.
MIT License
3.83k stars 838 forks source link

Ruby Warrior fails to launch if another program has created a file called .profile #35

Open mistydemeo opened 13 years ago

mistydemeo commented 13 years ago

Ruby Warrior is giving me an error when I attempt to launch it. Here's the error:

Welcome to Ruby Warrior /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/lib/ruby_warrior/profile.rb:31:inload': incompatible marshal file format (can't be read) (TypeError) format version 4.8 required; 98.139 given from /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/lib/ruby_warrior/profile.rb:31:in decode' from /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/lib/ruby_warrior/profile.rb:35:inload' from /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/lib/ruby_warrior/game.rb:8:in start' from /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/lib/ruby_warrior/runner.rb:17:inrun' from /Library/Ruby/Gems/1.8/gems/rubywarrior-0.1.2/bin/rubywarrior:5 from /usr/bin/rubywarrior:19:in load' from /usr/bin/rubywarrior:19

I'm using Ruby 1.8.7 on Mac OS X 10.6.7. I installed Ruby Warrior from RubyGems 1.8.2.

mistydemeo commented 13 years ago

Just an update - I used rvm to test with additional versions (1.8.6, 1.8.7 with latest patchset, 1.9.2) and still received the same error message, with a different number for "given".

mistydemeo commented 13 years ago

Just an update - based on a forum thread I found online, I figured out that I can successfully run Ruby Warrior if I use a directory other than my home directory. The error only happens if I launch from ~/

So, with a little more digging, it appears that the reason for the bug is the fact that the game assumes any file named .profile is an RW profile and tries to open it. Since .profile is a common settings profile file for shells, it's very possible for a file named .profile to already exist and mess things up.

I think using .profile is probably not the best idea for this reason - too big a chance of clash with other software. I'd recommend changing it to .rwprofile or .rw_profile. If you agree, I'll open a pull request to patch it.

ryanb commented 13 years ago

Thanks for researching this issue, and sorry I took so long to respond. Ruby Warrior is a hobby project and I haven't had a chance to work on it recently, but if you find the issue and want to submit a pull request that would be appreciated. Thanks!

mistydemeo commented 13 years ago

No worries! I understand you've been busy.

I'll go ahead and patch it, and submit a pull request.

Leandrogcb commented 12 years ago

I solved that problem creating a new directory like: ~/ruby/rubywarrior, then install the gem. cd ~ mkdir ruby/rubywarrior gem install rubywarrior