Problem creating folders on iOS device

356
1
08-10-2021 03:18 AM
JorgeFrade_Martínez
New Contributor III

Hi!

Im having troubles with the file structure of my app using the FileFolder qml type.

FileFolder{
id: appFolder
path: app.folder.path
}


When i launch the app i execute the next method on the Component.OnCompleted event of the App:

appFolder.makePath(AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/test/"))

That line returns a False

 

In other part of the app, i use the ZipReader to extract all the files that i get from my server, and that creates the folders without problem using the next line:

zipReader.extractAll(AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/test/" + zippedIdSim));

 

I really dont know if i doing something wrong, but it strange that it works perfectly on Windows but on iOS can not create folders with the makePath method...

The main objective is to create individual folders inside that path.

ArcGis
└AppStudio
└Data
└Test
└376646c3-9cd4-434f-b09c-0d8a22776f82
└{some files}
└e2068270-3c49-47b5-8b02-59a3cfae2654
└{some files}
└67a8ae80-ef1a-410b-abc1-0762364bfac0
└{some files}
└92c33799-d11c-4443-af36-7b5603d56c05
└{some files}
└dc087ef0-f590-49ee-9b29-fe252ec0cbb1
└{some files}
└92d3bcf8-6d66-45f8-8fe3-e0c8ce9d542f
└{some files}
└61825d42-e813-4ec4-991f-afeba2e64c3f
└{some files}

The ones that comes with a Zip file works perfectly, but if i need to create the folder manually don't work at all.

 

A greeting!

 

 

Tags (3)
0 Kudos
1 Reply
StephenQuan4
New Contributor II

You're mixing concepts. `app.folder` refers to content, including QML that is makes your app. Whilst developing, you run your app in AppStudio and/or Player and this area is read-write. However, the issue here is when you build your app, `app.folder` will refer to a read-only compiled resource and become read-only. Therefore, `app.folder` is not a fit area to unpack your data.

 

The `AppFramework.userHomeFolder` refers to a cross platform representation of a "HOME" directory. For Linux and macOS, this does equate to the actual home folder. Similarly for Windows. However, for iOS and Android this refers to a sandboxed area within your app. It is okay, to use. However, in your usage, you try to append the two areas together.

I like to draw your attention to our shorthand "~" syntax which is a shortcut for your home folder, so you do not need to explicitly spell it out. The usage is like this:

 

FileFolder {

    id: workspace

    path: "~/ArcGIS/AppStudio/Data/test"

}

Then, to ensure that folder exists, you correctly identify that `makePath` needs to be called, i.e. `workspace.makePath()`,

I hope these pointers put you in the right direction. I haven't commented on your usage of ZIP, I think it's straightforward. But, if you need further assistance, let me know and we will troubleshoot further.

0 Kudos