olistic / warriorjs

🏰 An exciting game of programming and Artificial Intelligence
https://warriorjs.com
MIT License
9.43k stars 490 forks source link

Linux/Unix/Darwin user profile conflicts with warrior profile filename #118

Closed antony closed 6 years ago

antony commented 6 years ago

In a Linux or Unix or Darwin shell, the profile name .profile conflicts with the user's local profile.

Environment

System:

Steps to reproduce

  1. Run warriorjs for the first time from the home directory.

Expected Behavior

warriorjs creates its directory and continues.

Actual Behavior

If you try to run warriorjs a first time in your home directory, and you have a local shell profile (.profile), it tries to read it and reports an invalid profile.

olistic commented 6 years ago

Hello @antony and thanks for your report. The reason that happens is because there's a feature that auto-selects the profile if you're running warriorjs from a profile directory (the directory named after your warrior/tower combination), which has a .profile file. If the contents of .profile are not what warriorjs expects, that could be because the file doesn't belong to the game (like in this case), or the player tinkered with the file.

When this was reported in #3, the solution was to give a friendly message asking the player to change the directory under which warriorjs was being run. Thinking it in retrospective, I think the detection of a "profile" directory can be improved, avoiding this problem. I'm going to open another issue.