olistic/warriorjs

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

antony opened this issue · 1 comments

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

Environment

System:

  • OS: Linux 4.13 Ubuntu 17.10 (Artful Aardvark)
  • CPU: x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
  • Memory: 243.71 MB / 7.70 GB
  • Container: Yes
  • Shell: 5.2 - /usr/bin/zsh

Binaries:

  • Node: 9.5.0 - ~/.nvm/versions/node/v9.5.0/bin/node
  • npm: 5.6.0 - ~/.nvm/versions/node/v9.5.0/bin/npm

npmGlobalPackages:

  • @warriorjs/cli: 0.3.0

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.

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.