olistic / warriorjs

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

Improve detection of profile directory for auto-select feature #119

Closed olistic closed 6 years ago

olistic commented 6 years ago

When running warriorjs, the first thing that is checked is if we are running the game from a profile directory, so we can auto-select that profile and avoid prompting the user. The method used to determine if we are in a profile directory is looking for a .profile file in the run directory. However, this method can lead to unwanted situations, as it was reported in #3, #11 and #118.

The proposal is to improve the detection of a profile directory. Instead of just looking for a .profile file, look for .profile and Player.js files. If both are present, try to load that profile, if not, go back to the normal flow where we ask the player to choose a profile.