<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QDir get current path not working in release mode on Mac]]></title><description><![CDATA[<p dir="auto">Hello,<br />
this my first time I work with QT on Mac on a virtual box I make a simple app and I want to create a folder in the current path so I use this code</p>
<pre><code>QDir dir(QDir::currentPath() + "/" + CurrentDate);
    if (!dir.exists()) {
        dir.mkdir(QDir::currentPath() + "/" + CurrentDate);
    }
</code></pre>
<p dir="auto">i run the app throw QT and i print the full path to the console and i got the path like this</p>
<pre><code>CurrentPath/Name_of_the_app/Contents/MacOS/CurrentDate
</code></pre>
<p dir="auto">so now the first problem is the folder not generated beside the app name it generated inside the app itself how can I fix that I tried to remove this part from the string of the full path but it not work</p>
<pre><code>FullPath = FullPath.remove("Name_of_the_app/Contents/MacOS");
</code></pre>
<p dir="auto">so it takes the path without inside the app but it not work.<br />
the second problem is when I run the app without QT it gives me a very strange output the path be like this</p>
<pre><code>//CurrentDate
</code></pre>
<p dir="auto">so what I did wrong make this mistake.<br />
Thanks in advance.</p>
]]></description><link>https://forum.qt.io/topic/94399/qdir-get-current-path-not-working-in-release-mode-on-mac</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 22:54:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/94399.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Sep 2018 11:35:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QDir get current path not working in release mode on Mac on Fri, 07 Sep 2018 21:36:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Rather than removing folder, you can you cd to go up to the folder where the app bundle is located..</p>
]]></description><link>https://forum.qt.io/post/480328</link><guid isPermaLink="true">https://forum.qt.io/post/480328</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 07 Sep 2018 21:36:03 GMT</pubDate></item><item><title><![CDATA[Reply to QDir get current path not working in release mode on Mac on Fri, 07 Sep 2018 12:06:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi! <code>QDir::currentPath()</code> or <code>qApp-&gt;applicationDirPath();</code> will be pointing to the application directory and adding another directory inside of it.</p>
<p dir="auto">I think you have to use: <code>QDir::mkpath(const QString &amp;dirPath)</code> function and add your path to the parameter. It will create all necessary dirs in the path.</p>
<p dir="auto">The <code>Qt</code> official documentation: <a href="http://doc.qt.io/qt-5/qdir.html#mkpath" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qdir.html#mkpath</a></p>
]]></description><link>https://forum.qt.io/post/480235</link><guid isPermaLink="true">https://forum.qt.io/post/480235</guid><dc:creator><![CDATA[Cobra91151]]></dc:creator><pubDate>Fri, 07 Sep 2018 12:06:41 GMT</pubDate></item></channel></rss>