We have moved to a new Sailfish OS Forum. Please start new discussions there.
1

Access filesystem with javascript

asked 2015-02-19 18:48:36 +0300

pLurchi gravatar image

Hi,

maybe I don't get it, but there is currently no support with sailfish sdk to read and write files using javascript?

I only want to read and write some textfiles. C++ is not my favourite language.

wishing sunny days pLurchi

edit retag flag offensive close delete

Comments

You want direct access from the browser to de filesystem? I don't think that that would be a great idea for the security.

heubergen ( 2015-02-19 18:54:19 +0300 )edit

No, I want to have access from an app. Of course the user should have the permission.

pLurchi ( 2015-02-19 22:50:30 +0300 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2015-02-19 19:26:08 +0300

leszek gravatar image

Mer.cutes provides access to the filesystem though it is not allowed into harbour (yet). For only writing and reading text files you can use XMLHttpRequest I guess.

See https://github.com/llelectronics/3ncode/blob/master/qml/logView.qml#L42 as a reference (this is for opening text files). For saving you can replace the GET from line 51 with PUT . The code itself is for qtquick 1.1 but the javascript should work also on QtQuick 2 never the less.

As for Mer.Cutes I used it in LLs Video Player (just like Jolla-Fileman did) but I switched to a c++ lib because it broke the part that was giving me a file listing. The other stuff should still work fine though. You can find some code as an example on the github history : https://github.com/llelectronics/videoPlayer/commits/master

edit flag offensive delete publish link more

Comments

Sounds good. I try your ideas. Of course it will take some time

pLurchi ( 2015-02-19 22:51:51 +0300 )edit

Thank you leszek, XMLHttpRequest works for me. I don't understand why you didn't used a callback in your logView, but anyway.

pLurchi ( 2015-02-20 11:44:39 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2015-02-19 18:48:36 +0300

Seen: 218 times

Last updated: Feb 19 '15