I've developed my app on Linux and run it like this:
projects/new> racket -t src/main.rkt
Now I want to run it on Windows and I'm getting this error:
open-input-file: cannot open input file
path: ...\projects\new\src\assets\world.json
system error: The system cannot find the path specified.; win_err=3
That makes sense, since the assets folder is not in src. This is my folder structure:
I don't get it. I've read the documentation for define-runtime-path, but in the first example given (data.txt) it's also just a relative path. What's the point?
And furthermore, it seems that I would have to do that for every single file I want to open. That seems quite cumbersome...
If I'm making my life unnecessary hard with this folder structure, I wouldn't mind changing it. However, I'd like somehting a bit more sophisticated than just putting everything in a single folder.
The point is that when you use define-runtime-path, nothing depends on the current working directory. You use a relative path there, and it always opens the path relative to that source file.
To avoid doing it for every distinct file, use define-runtime-path to specify a directory such as assets and then use build-path together with that path.
I must've missed that the path for define-runtime-path is relative to the source file and not the working directory. With that information it makes perfect sense. Thank you for pointing that out.
Will this still work once I create an executable? The executable will be in new/.