0

I have successfully downloaded image file from web by sending it with base64 from server. I used this tutorial to save that image on the device, but I need to specify the image directory according to different devices so I used the QStandardPaths::writableLocation(QStandardPaths::DataLocation) as the saveURL. The issue is that the directory returned looks like

/data/data/org.qtproject.example.WierszeApp/files/.local/share/libWierszeApp.so

and there is no way to read saved file. Also calling .cdUp() on the dir returns false as it's probably non readable/writable. What makes me dizzy is why does it return a file with .so extension? When I save it to hardcoded location like /sdcard/Download/ then I have no trouble.

Community
  • 1
  • 1
Nadarian
  • 962
  • 9
  • 22

1 Answers1

0

From the horse's mouth:

The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user."

There's nothing wrong with naming a directory with a .so extension. It's just the scheme that Qt has chosen, for whatever reason.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • `assets:/qml/WierszeApp/main.qml:94:5: QML Image: Cannot open: file://data/data/org.qtproject.example.WierszeApp/files/.local/share/libWierszeApp.so/i2.png` is what I get when i call `source: "file:/" + path + "/i2.png"` where path is the `QStandardPaths::...` expression – Nadarian Jul 01 '14 at 15:43
  • @Nadarian Have you created the path as the documentation suggests? – Kuba hasn't forgotten Monica Jul 01 '14 at 15:53
  • Ok, I didn't get what you mean at first. Thank you, it was quite a bit struggle for me – Nadarian Jul 01 '14 at 16:07
  • Actually if you could give me an advice of what am I now doing wrong? I have my path in `QDir mypath(QStandardPaths...)` variable. I check whether it exists `if(!mypath.exists())` if it doesn't I do `mypath.mkpath(".")` and it returns true but every time I launch the application the `if()` statement executes as if the dir was not created – Nadarian Jul 01 '14 at 16:36
  • Perhaps your development environment doesn't keep those files around? I don't know much about Qt on Android. – Kuba hasn't forgotten Monica Jul 01 '14 at 17:28