<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>QDir
dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));</tt><tt><br>
</tt><tt>if (!dir.exists()) {</tt><tt><br>
</tt><tt>
dir.mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));</tt><tt><br>
</tt><tt>}</tt><br>
<br>
<div class="moz-cite-prefix">08.08.2014 03:06, Krisztian Olah пишет:<br>
</div>
<blockquote
cite="mid:CACX4ZqZiusq-tmRfjc8hDbvvBzzDWDs6RkSMr5xfTVU5oK5O9Q@mail.gmail.com"
type="cite">
<div dir="ltr">Hi again,
<div style=""> I fixed the issue with applicationName() and
also figured out why setApplicationName() didn't work for me.
Basically I had a global Database object that got initalized
before main() was called, therefore setting applicationName in
main would have no effect in Database. Database is now an
object created on the heap to which all objects that need to
use it get a pointer.</div>
<div style="">
QStandardPaths::writableLocation(QStandardPaths::DataLocation)
now correctly returns "<span
style="font-family:arial,sans-serif;font-size:13px">/home/nemo/.local/share/harbour-myapp/"
however, setting it as a path does not work for me </span><span
style="font-family:arial,sans-serif;font-size:13px">/harbour-myapp
directory doesn't get created and my database doesn't get
saved.</span></div>
<div style=""><span
style="font-family:arial,sans-serif;font-size:13px">Saving
my data to /home/nemo/.local/share/ still works if I set the
path manually, I just cannot save the data in my
corresponding subdirectory with </span>QStandardPaths::writableLocation(QStandardPaths::DataLocation)<span
style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
<div style=""><br>
</div>
<div style="">Help would be greatly appricated</div>
<div style="">Kris</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 6 August 2014 14:20, Krisztian Olah
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:fasza2mobile@gmail.com" target="_blank">fasza2mobile@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,
<div>I just noticed that application name is not set and
QCoreApplication::applicationName() returns empty
string. Neither
QCoreApplication::setApplicationName(arg) nor
QGuiApplication::setApplicationName(arg) seem to make a
difference.</div>
<div>My db file is currently just dumped to
/home/nemo/.local/share appending with "/harbour-myapp/"
is not possible, I guess that
QCoreApplication::applicationName needs to be set in
order to get the proper path.</div>
<div><br>
</div>
<div>Internet search came up only with one relevant page
that just turned into a rant, but gave me little to no
insight.</div>
<div><br>
</div>
<div>How do I set applicationName? <a
moz-do-not-send="true"
href="https://lists.sailfishos.org/pipermail/devel/2014-February/003258.html"
target="_blank">https://lists.sailfishos.org/pipermail/devel/2014-February/003258.html</a>
seems to imly that it should happen automatically, so
does Qt's documentation here: <a moz-do-not-send="true"
href="http://qt-project.org/doc/qt-5/qcoreapplication.html#applicationName-prop"
target="_blank">http://qt-project.org/doc/qt-5/qcoreapplication.html#applicationName-prop</a></div>
<div><br>
</div>
<div>Thanks in advance</div>
<div>Kris</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 4 August 2014 00:01, <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:fasza2mobile@gmail.com"
target="_blank">fasza2mobile@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks again, works like a charm.<br>
<div><br>
On Sun Aug 03 2014 14:06:32 GMT+0100 (BST),
Lukas Vogel wrote:<br>
</div>
<div>
<div>> You shouldn't write in /usr/*
directory. Rather use standard path:<br>
> See <a moz-do-not-send="true"
href="https://lists.sailfishos.org/pipermail/devel/2014-February/003258.html"
target="_blank">https://lists.sailfishos.org/pipermail/devel/2014-February/003258.html</a><br>
><br>
><br>
> See also:<br>
> <a moz-do-not-send="true"
href="http://comments.gmane.org/gmane.comp.handhelds.sailfishos.devel/3632"
target="_blank">http://comments.gmane.org/gmane.comp.handhelds.sailfishos.devel/3632</a><br>
><br>
><br>
><br>
> 2014-08-03 15:00 GMT+02:00 Krisztian Olah
<<a moz-do-not-send="true"
href="mailto:fasza2mobile@gmail.com"
target="_blank">fasza2mobile@gmail.com</a>>:<br>
><br>
> > Hi I need a bit of help with saving
my database. When I do:<br>
> ><br>
> > QSqlDatabase db;<br>
> >
db.setDatabaseName("/usr/share/<harbour-myapp>/data/data.sqlite")<br>
> > db.open()<br>
> > ...<br>
> ><br>
> > I get this error: "QSqlQuery::exec:
database not open"<br>
> > thus the file isn't created at all.<br>
> > However if I change name to
"data.sqlite" it works fine, but saves it to<br>
> > /home/nemo/<br>
> > Could someone tell me what I need to
do in order to save the file under<br>
> > the correct path?<br>
> ><br>
> > Thanks in advance<br>
> > Kris<br>
> ><br>
> >
_______________________________________________<br>
> > SailfishOS.org Devel mailing list<br>
> > To unsubscribe, please send a mail
to<br>
> > <a moz-do-not-send="true"
href="mailto:devel-unsubscribe@lists.sailfishos.org"
target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br>
> ><br>
><br>
<br>
</div>
</div>
<div>
<div>--<br>
Sent from my Jolla</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
</blockquote>
<br>
</body>
</html>