<?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[Do Qt Programs Have Permssion to Copy Files to the Users Directory?]]></title><description><![CDATA[<p dir="auto">I am trying to copy a file from a qrc resource location to a temporary location where microsoft word can open it. The <code>copy()</code> method in the code below returns false. Any ideas why? I think it might be because the program doesn't have permission to copy the file to the user directory.</p>
<pre><code>const QString GNULicenseCopyDirectory = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
if (QFile::exists(GNULicenseCopyDirectory + "/COPYINGtemp.docx"))
    {
        QFile::remove(GNULicenseCopyDirectory + "/COPYINGtemp.docx");
    }
bool results = QFile::copy(":/resources/Copying.docx",
GNULicenseCopyDirectory + "/COPYINGtemp.docx");
QDesktopServices::openUrl("file:///" + GNULicenseCopyDirectory + "/COPYINGtemp.docx");
</code></pre>
]]></description><link>https://forum.qt.io/topic/82608/do-qt-programs-have-permssion-to-copy-files-to-the-users-directory</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 11:43:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/82608.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Aug 2017 19:57:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Do Qt Programs Have Permssion to Copy Files to the Users Directory? on Tue, 22 Aug 2017 20:52:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Are you sure the qrc path is correct ?</p>
<p dir="auto">You should also consider putting the path to the temp file in a variable. You are calling <code>GNULicenseCopyDirectory + "/COPYINGtemp.docx"</code> four times thus it means that if you modify the file name for whatever reasons, you'll have to do it also four times.</p>
]]></description><link>https://forum.qt.io/post/411710</link><guid isPermaLink="true">https://forum.qt.io/post/411710</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 22 Aug 2017 20:52:12 GMT</pubDate></item></channel></rss>