← Back to team overview

ubuntu-phone team mailing list archive

Re: Access XML file in ~/

 

On 01/07/2014 10:02 AM, Christian Dywan wrote:
On 30.12.2013 23:35, Israel wrote:
I want it to access the XML file from a relative ~/.config/
so far it seems I can only hard code the location..
Check out QStandardPaths:
http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html

QStandardPaths::writableLocation with QStandardPaths::ConfigLocation
should give you the interesting path.

Otherwise QDir::homePath() could be used, too.

So yeah, you need some slim C++ for that.
Hey Israel,

can you elaborate on what API you're using to read the XML? Are you
using QML or C++?

Most QML APIs don't actually cope with filenames. For instance
LocalStorage takes strings which are stored under filenames based on the
checksum internally. Similarly U1Db doesn't require paths by default.
XMLListModel can take filenames but has no writing capability.
If you use C++, QStandardPaths is indeed the way to go if you need a
filename or implement a QML component. And this is actually used in
several C++ components.


I'm actually looking to write an overview of different storage methods
inspired by this thread. The individual APIs are a bit scattered for
somebody starting afresh.

ciao,
     Christian

YES!! Please do that! I will look into QStandardPaths... I have found that this will require C++. I had hoped I could make something really quick to access and modify an XML file. It seems that QML has very little power in what it can do without C++. I had gotten a wrong impression that QML was quite capable of doing things with JavaScript (though JavaScript cannot save the XML it edits, either... only display...
Thanks again!!

--
Regards



References