Unexpected token
Closed this issue · 6 comments
When I try and run warriorjs on mac 10.10.3 with bash version 3.2 im getting this error
$ warriorjs
Welcome to WarriorJS
undefined:1
1���l"{-jY^��]�ب����]��ߵ����^��}uا��ڦ�覸����L{ڮ&�������+a1���l{h���L������
^
SyntaxError: Unexpected token �
at Object.parse (native)
at Function.decode (/usr/local/lib/node_modules/warriorjs/lib/Profile.js:313:19)
at Function.load (/usr/local/lib/node_modules/warriorjs/lib/Profile.js:318:57)
at Game.start (/usr/local/lib/node_modules/warriorjs/lib/Game.js:56:46)
at Runner.run (/usr/local/lib/node_modules/warriorjs/lib/Runner.js:42:18)
at Object.<anonymous> (/usr/local/lib/node_modules/warriorjs/bin/warriorjs:6:8)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
and node version v0.12.0
You are probably trying to lunch the game from a directory where a .profile file is already in. The reason of that error is that the game is assuming that any file called .profile is a WarriorJS profile and tries to open it. Please try to launch the game from another directory, or pass it a directory via the -d option while I fix this bug.
Yeah you are 100% correct about what the issue was. Just made another folder and than ran warriorjs inside of it and it worked. Thanks!
Fixing this issue by renaming the WarriorJS profile file will affect all existing player profiles, having a more expensive outcome than the one caused by this problem itself.
@olistic Maybe you should try and catch the error and give a friendly message about the issue. This way you will not break anyones games and the user can fix the issue like me.
@LucioFranco Fair enough, thanks!