textual-engine icon indicating copy to clipboard operation
textual-engine copied to clipboard

file loader cannot handle absolute paths

Open bzlibby opened this issue 4 years ago • 1 comments

when loading a game/world, using the world's absolute file path will return an error:

{"name":"textual-engine","kind":"main","hostname":"medusa","pid":11587,"level":50,"err":{"message":"ENOENT: no such file or directory, open '/home/bzlibby/documents/textual-enginge/data/samples/hansel-and-gretel.yml'","name":"Error","stack":"Error: ENOENT: no such file or directory, open '/home/bzlibby/documents/textual-enginge/data/samples/hansel-and-gretel.yml'","code":"ENOENT"},"msg":"error during read","time":"2021-06-26T03:28:02.564Z","v":0}

steps to reproduce:

  1. $ make run
  2. $ load file://<absolute path to world file>
  3. see error message
  4. $ load file://<relative path to world file>
  5. see world load successfully

bzlibby avatar Jun 26 '21 03:06 bzlibby

I am not able to reproduce this with a similar path or one with spaces:

turn 0 > load file:///home/ssube/code/ssube/text-adventure/data/samples/dracula.yml                  
no world states loaded from file:///home/ssube/code/ssube/text-adventure/data/samples/dracula.yml
turn 0 > worlds                                                                                   
test world (test)
Dracula (sample-dracula)

turn 0 > load file:///home/ssube/code/ssube/text-adventure/data/test samples/alice.yml
no world states loaded from file:///home/ssube/code/ssube/text-adventure/data/test samples/alice.yml
turn 0 > worlds
test world (test)
Dracula (sample-dracula)
Alice in Wonderland (sample-alice)

ssube avatar Aug 07 '21 15:08 ssube