<?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[Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;))]]></title><description><![CDATA[<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/268a248f-0c01-4650-ab3b-d8b58d98c92b.png" alt="13dd98a7-cb8a-4d70-aaf0-005b6c8bb869-image.png" class=" img-fluid img-markdown" /></p>
<pre><code>void Text2PcapWidget::on_toolButton_BrowserCapStoragePath_clicked()
{
    QString pcapStoragePath = QFileDialog::getExistingDirectory(this, UI_RES_CONTROL_TEXT2WIDGET_PCAP_DIAG_TITLE, DIAG_DEFAULT_DIR);
    if (pcapStoragePath.isEmpty()) {
        return;
    }

    ui-&gt;lineEdit_CapStoragePath-&gt;setText(pcapStoragePath);
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/128692/why-qfiledialog-getexistingdirectory-returned-non-native-directory-pcap-directory-below-with-not</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 06:30:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/128692.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jul 2021 05:26:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 08:11:02 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk said in <a href="/post/671800">Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with '/', not '\'))</a>:</p>
<blockquote>
<p dir="auto">toNativeSeparators</p>
</blockquote>
<p dir="auto">Thanks.That is OK.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/7e4a8669-ad24-429d-ba94-7c622b81b191.png" alt="a7839649-6128-426c-9d86-9f9aeb478baa-image.png" class=" img-fluid img-markdown" /></p>
<pre><code>void Text2PcapWidget::on_toolButton_BrowserCapStoragePath_clicked()
{
    QString pcapStoragePath = QFileDialog::getExistingDirectory(this, UI_RES_CONTROL_TEXT2WIDGET_PCAP_DIAG_TITLE, DIAG_DEFAULT_DIR);
    pcapStoragePath = QDir::toNativeSeparators(pcapStoragePath);
    if (pcapStoragePath.isEmpty()) {
        return;
    }

    ui-&gt;lineEdit_CapStoragePath-&gt;setText(pcapStoragePath);
}
</code></pre>
]]></description><link>https://forum.qt.io/post/671817</link><guid isPermaLink="true">https://forum.qt.io/post/671817</guid><dc:creator><![CDATA[angelyouyou]]></dc:creator><pubDate>Tue, 20 Jul 2021 08:11:02 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 07:22:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> The first time I used QDir, I was so disappointed with it, after I noticed that <code>exists</code> and <code>mkdir</code>/<code>mkpath</code> aren't static , that I never bothered to check what else actually is static. 😉</p>
]]></description><link>https://forum.qt.io/post/671804</link><guid isPermaLink="true">https://forum.qt.io/post/671804</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 20 Jul 2021 07:22:21 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 07:08:33 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk<br />
Since the method takes a parameter of the path to convert, <code>QString QDir::toNativeSeparators(const QString &amp;pathName)</code>, you can see it's a static rather than an instance method!  Along with a whole bunch of "utility" methods in <code>QDir</code> for acting on a specified path :)</p>
]]></description><link>https://forum.qt.io/post/671801</link><guid isPermaLink="true">https://forum.qt.io/post/671801</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 20 Jul 2021 07:08:33 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 07:02:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-kawa">@<bdi>Chris-Kawa</bdi></a> oh my goodness, <code>QDir::toNativeSeparators</code> is static 🤦‍♂️<br />
I never realised!</p>
]]></description><link>https://forum.qt.io/post/671800</link><guid isPermaLink="true">https://forum.qt.io/post/671800</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 20 Jul 2021 07:02:09 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 06:59:49 GMT]]></title><description><![CDATA[<p dir="auto">As mentioned above Qt uses / for all of its path handling. Use <a href="https://doc.qt.io/qt-5/qdir.html#toNativeSeparators" target="_blank" rel="noopener noreferrer nofollow ugc">QDir::toNativeSeparators</a> to convert the path for displaying in native format.</p>
<pre><code>void Text2PcapWidget::on_toolButton_BrowserCapStoragePath_clicked()
{
    QUrl pcapStorageUrl = QFileDialog::getExistingDirectoryUrl(this, UI_RES_CONTROL_TEXT2WIDGET_PCAP_DIAG_TITLE, QUrl(DIAG_DEFAULT_DIR));
    QString pcapStoragePath = pcapStorageUrl.toLocalFile();
    if (pcapStoragePath.isEmpty()) {
        return;
    }

    ui-&gt;lineEdit_CapStoragePath-&gt;setText(QDir::toNativeSeparators(pcapStoragePath));
}
</code></pre>
]]></description><link>https://forum.qt.io/post/671799</link><guid isPermaLink="true">https://forum.qt.io/post/671799</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Tue, 20 Jul 2021 06:59:49 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 06:50:38 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk<br />
Thanks for your help.<br />
I have used getExistingDirectoryUrl and toLocalFile, but the same case.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/0e7d0221-dd6e-433d-b32c-6970d3db5157.png" alt="c1ece0d5-805a-42be-9117-8a22fe13148c-image.png" class=" img-fluid img-markdown" /></p>
<pre><code>
void Text2PcapWidget::on_toolButton_BrowserCapStoragePath_clicked()
{
    QUrl pcapStorageUrl = QFileDialog::getExistingDirectoryUrl(this, UI_RES_CONTROL_TEXT2WIDGET_PCAP_DIAG_TITLE, QUrl(DIAG_DEFAULT_DIR));
    QString pcapStoragePath = pcapStorageUrl.toLocalFile();
    if (pcapStoragePath.isEmpty()) {
        return;
    }
    QDir::fromNativeSeparators(pcapStoragePath);

    ui-&gt;lineEdit_CapStoragePath-&gt;setText(pcapStoragePath);
}
</code></pre>
]]></description><link>https://forum.qt.io/post/671794</link><guid isPermaLink="true">https://forum.qt.io/post/671794</guid><dc:creator><![CDATA[angelyouyou]]></dc:creator><pubDate>Tue, 20 Jul 2021 06:50:38 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 06:38:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/angelyouyou">@<bdi>angelyouyou</bdi></a>  thats normal, Qt as cross platform framework, uses internally / as path separators and will also always return those to you, until otherwise specified. I would suggest using <code>getExistingDirectoryUrl</code>:</p>
<pre><code>QUrl pcapStoragePath = QFileDialog::getExistingDirectoryUrl(this, UI_RES_CONTROL_TEXT2WIDGET_PCAP_DIAG_TITLE, DIAG_DEFAULT_DIR);
    if (pcapStoragePath.isEmpty()) {
        return;
    }

    ui-&gt;lineEdit_CapStoragePath-&gt;setText(pcapStoragePath.toLocalFile());
</code></pre>
]]></description><link>https://forum.qt.io/post/671793</link><guid isPermaLink="true">https://forum.qt.io/post/671793</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 20 Jul 2021 06:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Fri, 23 Jul 2021 06:43:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/angelyouyou">@<bdi>angelyouyou</bdi></a> Qt internally uses / instead of \. So, you can use paths with / with Qt, even on Windows. Else, you can replace / with \ (<a href="https://doc.qt.io/qt-5/qstring.html#replace-3" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qstring.html#replace-3</a>).</p>
]]></description><link>https://forum.qt.io/post/671792</link><guid isPermaLink="true">https://forum.qt.io/post/671792</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 23 Jul 2021 06:43:38 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 06:22:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a><br />
sorry. I have updated my picture to compare the different.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/b102c46e-8352-4200-a412-e63b082fbc6f.png" alt="7b93d981-5a2d-4e3f-a2bb-cd79b50e1c47-image.png" class=" img-fluid img-markdown" /><br />
The wireshark path is obtained with the below code:</p>
<pre><code>void Text2PcapWidget::on_toolButton_BrowserWiresharkPath_clicked()
{
    QString wireshakSelectedPath = QFileDialog::getOpenFileName(this, UI_RES_CONTROL_TEXT2WIDGET_WS_DIAG_TITLE, DIAG_DEFAULT_DIR);
    if (wireshakSelectedPath.isEmpty()) {
        return;
    }

    QMessageBox::information(this, UI_RES_CONTROL_MESSAGEBOX_INFO, wireshakSelectedPath);
    ui-&gt;lineEdit_WiresharkPath-&gt;setText(wireshakSelectedPath);
}
</code></pre>
]]></description><link>https://forum.qt.io/post/671791</link><guid isPermaLink="true">https://forum.qt.io/post/671791</guid><dc:creator><![CDATA[angelyouyou]]></dc:creator><pubDate>Tue, 20 Jul 2021 06:22:53 GMT</pubDate></item><item><title><![CDATA[Reply to Why QFileDialog::getExistingDirectory returned non native directory?(pcap directory below with &#x27;&#x2F;&#x27;, not &#x27;&#x5C;&#x27;)) on Tue, 20 Jul 2021 05:37:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/angelyouyou">@<bdi>angelyouyou</bdi></a> What exact folder did you select for pcap? Is it on network drive?</p>
]]></description><link>https://forum.qt.io/post/671786</link><guid isPermaLink="true">https://forum.qt.io/post/671786</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 20 Jul 2021 05:37:54 GMT</pubDate></item></channel></rss>