<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hey guys,<br>While trying to build a little app to show the issue, I understood what I was doing wrong:<br>I was calling <font style="" face="Courier New"><span style=" color:#800080;">QStandardPaths</span></font><font style="" face="Courier New"><span style=" color:#000000;">::</span></font><font style="" face="Courier New"><span style=" color:#000000;">writableLocation</span></font><font style="" face="Courier New"><span style=" color:#000000;">(</span></font><font style="" face="Courier New"><span style=" color:#800080;">QStandardPaths</span></font><font style="" face="Courier New"><span style=" color:#000000;">::</span></font><font style="" face="Courier New"><span style=" color:#800080;">CacheLocation</span></font><font style="" face="Courier New"><span style=" color:#000000;">)</span></font> in the constructor of my c++ class and storing the result.<br>And in the main(), I was instantiating this c++ class before calling <span style=" color:#c0c0c0;"></span><font style="" face="Courier New">SailfishApp::application(argc, argv);</font><br>So the app name was not yet set, thus I was storing a bad path.<br><br>Vesku, you are right, QStandardPaths use applicationName and organizationName
when constructing paths.<br><br>The only thing that I don't understand is why it was working from the Terminal, but that's not that important :)<br><br>Thanks for your answers!!<br>Sylvain.<br><br><div><hr id="stopSpelling">Date: Mon, 20 Jan 2014 11:19:38 +0200<br>From: vesa-matti.hartikainen@jolla.com<br>To: devel@lists.sailfishos.org<br>Subject: Re: [SailfishDevel] QStandardPaths not working when app is run from Launcher<br><br>
<div class="ecxmoz-cite-prefix">Hi,<br>
<br>
I think QStandardPaths use applicationName and organizationName
when constructing paths.<br>
<br>
So solution would be something like <br>
app->setApplicationName("harbour-yourapp");<br>
app->setOrganizationName("harbour-yourapp");<br>
<br>
And then QStandardPaths will start giving paths that follow
harbour guidance.<br>
<br>
BR,<br>
Vesku<br>
<br>
<br>
On 01/19/2014 05:32 PM, Robin Burchell wrote:<br>
</div>
<blockquote cite="mid:75B50403-8543-4560-B388-AE706F5DB98B@jolla.com">
Hi,
<div><br>
</div>
<div>Can you please provide a small sample demonstrating this? As
I’m quite sure it works for our own uses.</div>
<div><br>
</div>
<div>BR,</div>
<div>Robin</div>
<div><br>
<div>
<div>On 19 Jan 2014, at 14:34, Sylvain B. <<a href="mailto:sthocs@hotmail.com">sthocs@hotmail.com</a>>
wrote:</div>
<br class="ecxApple-interchange-newline">
<blockquote>
<div class="ecxhmmessage" style="font-size:12pt;font-family:Calibri;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">
<div dir="ltr">Hey,<br>
My app did not want to read the some cached content it
was supposed to have written in<span class="ecxApple-converted-space"> </span><tt>QStandardPaths::CacheLocation</tt>.<br>
To understand why, I tried to run it from the terminal,
and... everything is working fine.<br>
Since we don't have logs when we run the app directly
from Launcher, I updated it to display some logs
directly in the UI and I figured out that, when the app
is run from the Launcher on the actual device (it's ok
on the emulator), QStandardPaths does not work
correctly:<br>
<br>
<tt>QStandardPaths::CacheLocation<span class="ecxApple-converted-space"> </span></tt>returns
/home/nemo/.cache/mdeclarativecache_pre_initialized_qapplication-XXXXX<br>
<br>
XXXXX is a random number, so each time I run my app, it
creates a new one.<br>
When run from terminal,<span class="ecxApple-converted-space"> </span><tt>QStandardPaths::CacheLocation<span class="ecxApple-converted-space"> </span></tt>correctly
returns /home/nemo/.cache/<br>
<br>
I tried with<span class="ecxApple-converted-space"> </span><tt>QStandardPaths::DataLocation<span class="ecxApple-converted-space"> </span></tt>but it's
the same, I get
/home/nemo/.local/share/AppName/mdeclarativecache_pre_initialized_qapplication-XXXXX<br>
<br>
So for the moment, I temporarily hardcoded
/home/nemo/.cache/<br>
<br>
Thanks!<br>
Sylvain.<br>
</div>
_______________________________________________<br>
<a href="http://sailfishos.org/" target="_blank">SailfishOS.org</a><span class="ecxApple-converted-space"> </span>Devel mailing list</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="ecxmimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
SailfishOS.org Devel mailing list</pre>
</blockquote>
<br>
<br>
<pre class="ecxmoz-signature">--
Vesa-Matti Hartikainen
Jolla Oy
<a class="ecxmoz-txt-link-freetext" href="http://jolla.com" target="_blank">http://jolla.com</a>
p. +358 50 487 6067</pre>
<br>_______________________________________________
SailfishOS.org Devel mailing list</div> </div></body>
</html>