<div dir="ltr">Hi,<div>i have some questions about what are the correct config and data paths for an application.</div><div>The harbour faq [ <a href="https://harbour.jolla.com/faq#2.4.0">https://harbour.jolla.com/faq#2.4.0</a> ] says that for these paths a subfolder during run time named <HARBOUR_APP_NAME> inside a folder defined by the XDG Base Directory Specification should be used. My question is how to get these values using QT.</div><div>I though of using the QStandardPaths [ <a href="http://doc.qt.io/qt-5/qstandardpaths.html">http://doc.qt.io/qt-5/qstandardpaths.html</a> ] or the QProcessEnvironment [ <a href="http://doc.qt.io/qt-5/qprocessenvironment.html">http://doc.qt.io/qt-5/qprocessenvironment.html</a> ] modules, but i don't know if i am getting the correct values.</div><div><br></div><div>Using the QStandardPaths module I get this output:</div><div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:66 - QStandardPaths::DataLocation: "/home/nemo/.local/share/harbour-batzap/harbour-batzap"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:67 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::GenericDataLocation: "/home/nemo/.local/share"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:68 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::CacheLocation: "/home/nemo/.cache/harbour-batzap/harbour-batzap"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:69 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::GenericCacheLocation: "/home/nemo/.cache"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:70 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::TempLocation: "/tmp"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:71 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::ConfigLocation: "/home/nemo/.config"<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:72 - </span><span style="color:rgb(170,0,0);font-family:monospace;font-size:12px">QStandard</span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">Paths::GenericConfigLocation: "/home/nemo/.config" </span></blockquote>
</div><div>(i'm returning these values using: <i>qDebug() << "QStandardPaths::<enum-name>: " << QStandardPaths::writableLocation(QStandardPaths::<enum-name>);</i></div><div><br></div><div>According to the harbour faq, for application data the $XDG_DATA_HOME/<harbour-name> folder should be used, ( <a href="http://freedesktop.org">freedesktop.org</a> says that a possible value for $XDG_DATA_HOME is "$HOME/.local/share/", so i'll assume that value, and assuming <harbour-name> is "harbour-batsap") should the correct application data folder be "/home/new/.local/share/harbour-batzap" insted "/home/new/.local/share/harbour-batzap/harbour-batzap" as qt returns for QStandardPaths::DataLocation? </div><div><br></div><div>Note: the qt docs suggest that <i>QStandardPaths::AppDataLocation</i> should be used while <i>QStandardPaths::DataLocation</i> is a deprecated value. But i'm getting errors (<i>AppDataLocation </i>is not a member of <i>QStandardPaths</i>) using <i>QStandardPaths::AppDataLocation</i> (it was introduced in Qt 5.4, i really don't remember what Qt5 version jolla ships)</div><div><br></div><div>If i try to get the values of the XDG variables using the QProcessEnvironment module, i'm always getting blank values:</div><div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:75 - QProcessEnvironment::systemEnvironment().value("$XDG_DATA_HOME"): ""<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:76 - QProcessEnvironment::systemEnvironment().value("XDG_DATA_HOME"): ""<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:77 - QProcessEnvironment::systemEnvironment().value("$XDG_CACHE_HOME"): ""<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:78 - QProcessEnvironment::systemEnvironment().value("XDG_CACHE_HOME"): ""<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:79 - QProcessEnvironment::systemEnvironment().value("$XDG_CONFIG_HOME"): ""<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:80 - QProcessEnvironment::systemEnvironment().value("XDG_CONFIG_HOME"): "" </span></blockquote>
<div>(i'm returning these values using: <i>qDebug() << "QProcessEnvironment::systemEnvironment().value(<variable>, "");</i><br></div><div><i><br></i></div><div>Using qDebug() << "getenv(<variable>): " << <i>getenv(<variable>);</i> also returns me an empty value:</div><div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote"><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:81 - getenv("XDG_DATA_HOME"):<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:82 - getenv("$XDG_DATA_HOME"):<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:83 - getenv("XDG_CACHE_HOME"):<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:84 - getenv("$XDG_CACHE_HOME"):<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:85 - getenv("XDG_CONFIG_HOME"):<br> </span><span style="font-family:monospace;font-size:9pt;color:rgb(170,0,0)">[D] main:86 - getenv("$XDG_CONFIG_HOME"): </span></blockquote>
</div><div><i><br></i></div><div>I'm executing the app thought qtcreator in my jolla device (deploying it as an RPM package).</div><div><br></div><div>What are the correct path values? and how should I get them throught qt?.</div><div><br></div><div>Thanks!</div>-- <br><div class="gmail_signature">Nicolas Cisco<br><a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br></div>
</div></div>