Categories
Computers & Software

Spaces in Paths are Evil!

This comes as no surprise to anyone who has wrestled with this problem. While trying to make sure that the EP Simulator program builds and runs on Windows, I ran into trouble using absolute paths in my qmake *.pro files. Qmake is a tool from Qt Software that generates a Makefile that builds the program. Everything worked fine in Linux, where the path to the program directory is /home/mannd/dev/git/epsimulator. In Windows (XP) I had set up the following path in my “home” directory: L:\Documents and Settings\mannd\dev\git\epsimulator. This path though breaks the Makefile, since the path gets split into a “L:Documents”, an “and” and a “Settings\…” path, which totally screws everything up. Of course I tried putting quotes around the path, but this does not correct the problem; somewhere inside qmake the quotes get stripped and the path goes the Makefile which mangles it like before. I tried various sed-like scripts to escape the spaces, substitute forward for backslashes, but to no avail. The problem seems to be infinitely compounded by the fact that Windows uses backslashes instead of forward slashes as a path delimiter, and so the escape characters are reversed from unix usage, and the whole thing is a big mess. Yes I know you can use forward slashes in Windows instead of backslashes, but Windows also uses forward slashes to set off command options (e.g. copy /x) so what’s a poor unix-based make and gcc to do? Get messed up, that’s what. I also know spaces are allowed in Linux paths, but there are no spaces in critical file paths like “\Program Files” and “\Documents and Settings” in Windows. And yes finally I am aware that Microsoft has changed these file names in Vista to eliminate spaces. Thank you! In the meantime, I gave up on using absolute paths in my qmake files (using relative paths like “../../lib” instead) and so continue to move on.