Silly detail (JuceHeader path)

I was wondering why the introjucer always generates

If this works just fine and looks better:

  • Bram

Well, because the first version is always guaranteed to work, but the second one will only work if your build environment has been set-up with a suitable include path.

But… By default the introjucer adds the correct include path.

New project -> save -> change include -> builds fine.

Bram

Maybe it does.

But given the choice between a line of code that always finds the correct target file under all circumstances, or a line of code that relies on some other project setting to be correct, why would anyone choose the latter?

Because it may lead people to believe there’s a spurious include. I know it confused me for a second.

Spurious? I don’t understand why that’d be confusing…?

If you are already adding the correct directory in the include paths (even without the user saying that this include path should be there), why would you then still use a relative include? To me that sounds like a fix in two places where only one is needed.

  • bram

Thanks Bram - yes that’s what I meant by spurious.

Seriously Jules, your code is so neat that I see something like that and I think maybe I’m doing something wrong :slight_smile: In the end I ignored it because everything was obviously working.

IMHO whenever it’s possible to use an explicit path, you should always do so. It’s only when your code includes something external which isn’t in a fixed location that you should rely on the include path to find it.

Sounds like a good maxim for your Coding Standards wiki Jules.