<div dir="ltr">Thanks Andrey,<div style>I thought it was supposed to get created automatically.</div><div style>It works flawlessly now</div><div style>Thanks again</div><div style>Kris</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 7 August 2014 21:09, Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@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 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>08.08.2014 03:06, Krisztian Olah пишет:<br>
    </div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">Hi again,
        <div>  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> 
          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><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><br>
        </div>
        <div>Help would be greatly appricated</div>
        <div>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 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 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 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>
              <div>
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">On 4 August 2014 00:01, <span dir="ltr"><<a 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 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 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 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 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></fieldset>
      <br>
      <pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br></div>