I have a build system tool that is using getcwd()
to get the current working directory. That's great, except that sometimes people have spaces in their paths, which isn't supported by the build system. You'd think that you could just make a symbolic link:
ln -s "Directory With Spaces" DirectoryWithoutSpaces
And then be happy. But unfortunately for me, getcwd()
resolves all the symbolic links. I tried to use getenv("PWD")
, but it is not pointing at the same path as I get back from getcwd()
. I blame make -C
for not updating the environment variable, I think. Right now, getcwd()
gives me back a path like this:
/Users/carl/Directory With Spaces/Some/Other/Directories
And getenv("PWD")
gives me:
/Users/carl/DirectoryWithoutSpaces
So - is there any function like getcwd()
that doesn't resolve the symbolic links?
Edit:
I changed
make -C Some/Other/Directories
to
cd Some/Other/Directories ; make
And then getenv("PWD")
works.. If there's no other solution, I can use that.