title: How to retrieve the location of an item in the Resources folder of an OS X application bundle, in Qt
body: <p>I need to get the path to the application dir or the executable.</p>
  
  <p>I found that </p>
  
  <pre><code>QString appPath = QCoreApplication::applicationDirPath();
  </code></pre>
  
  <p>would be the way to do it.</p>
  
  <p>But when I run, I get error:</p>
  
  <pre><code>QCoreApplication::applicationDirPath: Please instantiate the QCoreApplication object first
  </code></pre>
  
  <p>If i try to create an instance of QCoreApplication though i get build errors...</p>
  
  <pre><code>error: no matching function for call to 'QCoreApplication::QCoreApplication()'
  </code></pre>
  
  <p>Using QApplication instead of QCoreApplication gives me a similar error.</p>
  
  <p>This call is not made from main() that instantiates an application type class... it is from a config class very far away.</p>
  
  <p>How is this done ?</p>
  
  <p>Qt 4.8</p>
  
  <p>Note: what I am trying to get is the actual app directory (for mac, i will use it to generate an absolute path to Contents/Resources). </p>
  
  <p>Using a relative path did not work (I got a funny @ symbol when I printed the path, before the relative path portion, and the file I tried to load from there failed to load)</p>
  
  <pre><code>@/myapplication.app/Contents/Resources/myfile
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>path/myapplication.app/Contents/Resources/myfile
  </code></pre>