Closed chenbowen closed 6 years ago
Either way is fine. Changing paths might make it harder to grade, so I'd copy the STL model.
We should fix this in the read_json.h
file. How can we direct windows to find the path? @psarahdactyl can you test this on windows? I'm guessing the problem is that the working directory is not correct.
Well so in windows we can run the executable from the directory where it is generated, or we can run the VS project from the IDE which I think uses wherever main.cpp is. There is probably a VS setting to set the execution directory to something else. I can look into it.
Could you see if dirname
and the PATH_SEPARATOR
on https://github.com/alecjacobson/computer-graphics-ray-casting/blob/2daf549f27572528b659c05842e33f29ef061a91/include/read_json.h#L112 are returning what they're supposed to?
I think I found the problem.
filename
has value ../shared/data/bunny.json
.
But igl::dirname(filename)
returns .
. The reason is igl::dirname()
can only search \\
in the path on windows but not /
.
Thanks, @chenbowen. I'll investigate. For now, does it work if you change the hardcoded path to ..\shared\data\bunny.json
?
No, it does not work. If I change the hardcoded path to ..\shared\data\bunny.json
, filename
becomes ..shareddata\bunny.json
immediately. But it works if I change the path to ..\\shared\\data\\bunny.json
.
ah, right. yes, C++ needs \\
to mean \
inside a string.
Well, so this is a solution for windows users for now. The better solution is to fix dirname
to work correctly. That might come later, but shouldn't stop anyone from working.
@chenbowen or @psarahdactyl , could you try using this new dirname.h
https://github.com/alecjacobson/computer-graphics-ray-casting/blob/42d330ca88e32b1ff786156ddda07014a410e8b2/include/dirname.h
I'm hoping it fixes the issue on windows without having to change any other files/paths.
Yes, the new dirname.h
works for ../shared/data/bunny.json
.
I‘m using visual studio 2017 on windows 10 and got this error. I found in "read_json.h", line 110, the value of variable "stl_path" is just "bunny.stl". So how should I fix it? Change the path of "bunny.stl" through "bunny.json" or copy the STL model to the "build" folder?