FileFolder QML Type writeFile Chormebook

646
2
03-30-2021 06:59 AM
by Anonymous User
Not applicable

I have a custom application, where the goal is to create a list with the app and export this list to the device as an .txt or .csv. With the FileFolder QML Type, I am able to obtain my folder path and create the string to be written. 

The issue I am running into is when using a chromebook device (Chrome OS), the file is created but is created as an empty file; the contents are not being passed along. The same application will work properly on any Windows or MacOS system. 

example: 

FileDialog {  //user obtained file path.
    id: fileDialog2
    folder: shortcuts.desktop  //brings user to main path regardless of os.
    selectFolder: true

    Item {
         FileFolder {
        id: fileFolder3
    }
}

fileFolder3.writeFile("testing.csv", "testing, 2") //string is set up as comma delimited. 

 

Any ideas or workarounds, or is this just an OS limitation issue?

 

-Kyle

0 Kudos
2 Replies
ErwinSoekianto
Esri Regular Contributor

@Anonymous User 

 

Very possible that it might be a limitation with the Chromebook, unfortunately, we don't have any to test with. Can you try to just use the path like "~" instead of the shortcuts.desktop?

 

Thank you,

Erwin

0 Kudos
by Anonymous User
Not applicable

It does appear to be a limitation with the Chromebook and how it is reading the selected file path. There may be something I am missing but the folder navigation does not appear to be the issue. So using the shortcuts.desktop  was only giving the starting point of where to save the the file (I am most likely going to switch it to "~" anyways since I like that for the other platforms).

What I noticed, when using the application in a Chromebook and a file folder location is chosen, it is outputting the file path: "content://com.android.externalstorage.documents/tree/0000000000000000000000000000CAFEF00D20%3ADownloads" 

This path is allowing for the creation of my file in the correct location, however it is creating it as an empty file. I was able to do a workaround and just hardcode a file path, although not desirable since one is not able to select where they wish to save the file, it is working correctly.

hardcoded file path: "/storage/emulated/0/download"

 

Thanks again for the suggestions.

0 Kudos