lemnos / tt

A terminal based typing test.
MIT License
714 stars 48 forks source link

Windows compatibility #46

Open akainth015 opened 8 months ago

akainth015 commented 8 months ago

When I tried to compile tt on Windows, I faced the following bugs.

  1. The word list was not found, because the path passed to readPackedFile was formatted as words\1000en instead of words/1000en. This is problematic since the packedFiles map has hard-coded keys in the words/1000en format. To fix this bug, I replaced the call to filepath.Join with a hard-coded /.
  2. The home directory was not found because the HOME environment variable is not defined on Windows. I was able to define $env:HOME = $env:USERPROFILE and use tt successfully, so I updated the program to perform this substitution when the HOME environment variable is not defined.

These two changes make tt at least minimally usable on Windows!

akainth015 commented 8 months ago

I suppose this PR would be incomplete without a screenshot, so here it is:

image