ryanb / ruby-warrior

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

Running ruby-warrior in Windows doesn't work by default #29

Closed Nitrodist closed 12 years ago

Nitrodist commented 14 years ago

Using the 1.8.7-p302 on Windows 7 x86, running ruby-warrior after extracting doesn't work out of the box.

The issue here is that the script to run ruby is the same name as the directory in which the player files are stored. Changing the 'rubywarrior' file in /bin/ to 'rubywarrior.rb' solves this on windows and it can run normally.

    C:\Users\jjusr\Downloads\ryanb-ruby-warrior-2dd76f6\rubywarrior\bin>ruby rubywarrior
    Welcome to Ruby Warrior
    [1] beginner
    [2] intermediate
    Choose tower by typing the number: 1
    Enter a name for your warrior: mark
    C:/Ruby/lib/ruby/1.8/fileutils.rb:244:in `mkdir': File exists - ./rubywarrior (Errno::EEXIST)
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:244:in `fu_mkdir'
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:217:in `mkdir_p'
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:215:in `reverse_each'
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:215:in `mkdir_p'
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:201:in `each'
    from C:/Ruby/lib/ruby/1.8/fileutils.rb:201:in `mkdir_p'
    from ./../lib/ruby_warrior/player_generator.rb:23:in `generate'
    from ./../lib/ruby_warrior/level.rb:41:in `generate_player_files'
    from ./../lib/ruby_warrior/game.rb:111:in `prepare_next_level'
    from ./../lib/ruby_warrior/game.rb:60:in `play_normal_mode'
    from ./../lib/ruby_warrior/game.rb:23:in `start'
    from ./../lib/ruby_warrior/runner.rb:17:in `run'
    from rubywarrior:5

After changing the file:

    C:\Users\jjusr\Downloads\ryanb-ruby-warrior-2dd76f6\rubywarrior\bin>ruby rubywarrior.rb
    Welcome to Ruby Warrior
    No rubywarrior directory found, would you like to create one? [yn] y
    [1] beginner
    [2] intermediate
    Choose tower by typing the number: 1
    Enter a name for your warrior: mark
    First level has been generated. See the rubywarrior/mark-beginner/README for instructions.