Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

.profile confusion #40

Closed
wants to merge 1 commit into from

3 participants

Mark Campbell Lukas Stejskal Ryan Bates
Mark Campbell

Fixed a bug where if you tried to start the game with your operating system's '.profile' file (used for initializing your terminal's settings) that it would error out by trying to load that file instead of the proper '.profile' in the ruby-warrior's data directory.

The fix is it won't load the file if your $HOME directory is the same as the directory you're running ruby-warrior from.

Mark Campbell Nitrodist Fixed a bug where if you tried to start the game with your operating …
…system's '.profile' file (used for initializing your terminal's settings) that it would error out by trying to load that file instead of the proper '.profile' in the ruby-warrior's data directory.

The fix is it won't load the file if your $HOME directory is the same as the directory you're running ruby-warrior from.
d4280d4
Ryan Bates
Owner

Do we know if this will cause any conflicts with Windows?

To my knowledge, .profile isn't a standard Windows file. I don't think there could be a conflict. That said, I am not 100% sure.

Writing to .profile should be fine. In Windows, ENV["HOME"] returns nil unless specifically set, so the updated condition will be true even if the "$HOME directory is the same as the directory you're running ruby-warrior from". No big deal though, because Windows don't use .profile file.

However, I don't like this patch. I'd rather changed default config file to something like ~/.rw_profile or even ~/.ruby-warrior/profile. Besides configuration, the ~/.ruby-warrior directory could eventually contain data for custom towers, etc.

I agree, change the name of the .profile file.

Mark Campbell Nitrodist closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2011
  1. Mark Campbell

    Fixed a bug where if you tried to start the game with your operating …

    Nitrodist authored
    …system's '.profile' file (used for initializing your terminal's settings) that it would error out by trying to load that file instead of the proper '.profile' in the ruby-warrior's data directory.
    
    The fix is it won't load the file if your $HOME directory is the same as the directory you're running ruby-warrior from.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/ruby_warrior/game.rb
2  lib/ruby_warrior/game.rb
View
@@ -4,7 +4,7 @@ class Game
def start
UI.puts "Welcome to Ruby Warrior"
- if File.exist?(Config.path_prefix + '/.profile')
+ if File.exist?(Config.path_prefix + '/.profile') and ENV['HOME'] != File.expand_path(Config.path_prefix)
@profile = Profile.load(Config.path_prefix + '/.profile')
else
if File.exist?(Config.path_prefix + '/ruby-warrior')
Something went wrong with that request. Please try again.