title: Qt QDir::current()
body: <p>I had some code like this:</p>
  
  <pre><code>void MainWindow::saveData()
  {
      QDir oldDir=QDir::current();//this should return the main executable directory.Since there is no other place in my hole code where i temper with QDir.
      QDir sess("Sessions");
      if(!oldDir.exists("Sessions"))//if "Sessions" Dir doesn't exist 
          oldDir.mkdir("Sessions");//create it.
      QDir::setCurrent(sess.absolutePath());
      //some virtual code inside current Dir, which i didn't implement yet.
      QDir::setCurrent(oldDir.absolutePath());//restore old dir
  }
  </code></pre>
  
  <p>When I run my app firstly the code works perfectly.but in the second run, the first call to <code>QDir::current();</code> returns the "Sessions" Dir and not the main executable Dir as it should be restored in the first run.actually i did manage to overcome this by adding one line at the biginning of the code, the following :</p>
  
  <pre><code>QDir::setCurrent(QCoreApplication::applicationDirPath());
  </code></pre>
  
  <p>Still I want to know why the first code didn't work.already checked for the documentation of the functions and found nothing.</p>