parseAbsolutePath and CWD


I’ve noticed that in parseAbsolutePath, when we encounter “./” at the beginning of the file we strip it off, but we
don’t prepend the current working directory. On unix systems “./” always refer to the current working directory.
If we leave it like this, i’m always getting the jassertfalse everytime i start my application if i start it from the terminal:

kraken@roxxorx ~/Projects/myapp/bin > ./myapp
JUCE v1.51
JUCE Assertion failure in ../src/juce/juce_amalgamated.cpp, line 5957

and this is annoying when debugging with GDB cause it always stop to that assertion.

Isn’t more correct to treat “./” as current working directory instead of stripping it off ?


Excellent point. I’ll get that sorted out, thanks!


No, sorry - I just thought about this again. You should never actually hit this situation - if you’re parsing a filename in a context where you know it will either be absolute or relative to the CWD (as you would in a command-line app), then you should always write File::getCurrentWorkingDirectory().getChildFile (commandlineparam), and never just throw the string directly into the File class.

I put the assertion in there deliberately to remind people that whenever you’re parsing an unknown path name, you must explicitly supply a context, in case it’s a partial path.


yes, but i’m getting the assert everytime i use:

it’s not my own code that generates the assert. in the case the current executable starts with “./” then it’s a perfectly known place.


Ah, right… Ok, I’ll make sure that doesn’t happen. Thanks!