<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi,</div><div><br></div><div>What comes to having datalocation path variable in the .pro file:</div><div>I was having similar thoughts when I wanted to install something in the writable storage location, but I was corrected. Nothing should be installed in the home directory with the application, but under application directory /usr/share/harbour-yourappname/. There can be also subdirs under that location. Then, at runtime, you can create the writable storage location if it does not exist, and copy or create stuff there. Preferably the app would not pre-install any data, but everything would be downloaded / created runtime. That would be the ideal though, not always applicable.</div><div><br></div><div>- Saija</div><div>@setelani</div><div>matrixx #sailfishOS<br><br>Lähetetty iPadista</div><div><br>"Andrey Kozhevnikov" <<a href="mailto:coderusinbox@gmail.com">coderusinbox@gmail.com</a>> kirjoitti 18.6.2014 kello 8.50:<br><br></div><blockquote type="cite"><div>
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  
    you should build and deploy as RPM package ;)<br>
    <br>
    <div class="moz-cite-prefix">18.06.2014 03:42, Lukas Vogel пишет:<br>
    </div>
    <blockquote cite="mid:CAJG5b_UPhbbHT5-nFWBVBt_hBQPPdgERd-9U8T+1tH3ULdrrKA@mail.gmail.com" type="cite">
      <div dir="ltr">Hi there,
        <div><br>
        </div>
        <div>I try to create an app in which I want to have an existing
          database bind in the binary.</div>
        <div><br>
        </div>
        <div>My approach was the following: </div>
        <div>in pro file:</div>
        <div>
          <font color="#000000">QT</font><span style="color:rgb(192,192,192)"> </span>+=<span style="color:rgb(192,192,192)"> </span>sql</div>
        <div>
          <pre style="margin-top:0px;margin-bottom:0px"></pre>
          <pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px">database.files<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>stations.db</pre><pre style="margin-top:0px;margin-bottom:0px">database.path<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>/home/nemo/.local/share/harbour-qtimetable/harbour-qtimetable</pre>
<pre style="margin-top:0px;margin-bottom:0px">INSTALLS += database</pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">To open the database:</pre><pre style="margin-top:0px;margin-bottom:0px">db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(DB_NAME);
db.setUserName(USER_NAME);
db.setPassword(PASSWORD);
db.setConnectOptions("QSQLITE_OPEN_READONLY=1");
</pre><pre style="margin-top:0px;margin-bottom:0px">if(db.open()) {...}</pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">for DB_NAME I use QStandardPaths::writableLocation(QStandardPaths::DataLocation) with stations.db appended. </pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">However when I deploy this will fail as the path on emulator has</pre>
<pre style="margin-top:0px;margin-bottom:0px">home/deploy/installroot/ prefix, and when deploying on device there is /opt/sdk/..
</pre><pre style="margin-top:0px;margin-bottom:0px">prefix. </pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">This makes testing quite annoying, is there a genuine way to get the database to open both in the emulator and the device? </pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">Side question is there a "standard path::datalocation" variable for the .pro file?</pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">Thanks for any help,</pre><pre style="margin-top:0px;margin-bottom:0px">Lukas</pre></pre>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a href="http://SailfishOS.org">SailfishOS.org</a> 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>
  

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