This wouldn't work. Android doesn't let you write to the root folder of the 
device. It strongly limits write access in the OS.

On Wednesday, January 13, 2021 at 8:41:45 PM UTC+2 P5music wrote:

> I created this method:
>
> public static String getRootPath()
> {
> String os=Display.getInstance().getPlatformName();
>
> if (os.toLowerCase().contains("ios")) {
> String documentsRoot=FileSystemStorage.getInstance().getRoots()[0];
> int pos=documentsRoot.lastIndexOf("Documents");
> String libraryRoot=documentsRoot.substring(0,pos)+"Library";
> return libraryRoot+"/";
>
> }
>
> return FileSystemStorage.getInstance().getRoots()[0]+"/";
>
> }
>
> This clearly has to be used with FileSystemStorage not Storage.
> FileSystemStorage.getInstance
> ().openOutputStream(getRootPath()+fileName+".ext");
> So the result would be the same? That is, the private folder would be 
> accessed and written even if it points to private Storage?
>
> Regards
> Il giorno mercoledì 13 gennaio 2021 alle 09:48:53 UTC+1 P5music ha scritto:
>
>> Please tell me the Android method that is called, so at least I can 
>> assess what private/not private folder you picked up in this case.
>> Regards
>>
>> Il giorno mercoledì 13 gennaio 2021 alle 04:16:59 UTC+1 Shai Almog ha 
>> scritto:
>>
>>> You mean the storage folder?
>>> I have no idea where that is.
>>>
>>> On Tuesday, January 12, 2021 at 10:22:21 AM UTC+2 P5music wrote:
>>>
>>>> I just need to  know the path of the corresponding directory in Android 
>>>> that the app sees as "/".
>>>> (in iOS you said it is the app folder Document)
>>>> Thanks
>>>>
>>>> Il giorno martedì 12 gennaio 2021 alle 03:39:35 UTC+1 Shai Almog ha 
>>>> scritto:
>>>>
>>>>> Sorry. I'm not aware of any such path. 
>>>>>
>>>>> On Monday, January 11, 2021 at 8:20:23 PM UTC+2 P5music wrote:
>>>>>
>>>>>> My idea about paths seem to be right.
>>>>>> But I need to know what is the app private folder path in Android, so 
>>>>>> to create a fallback when I run/test on Android device/emulator.
>>>>>> I suppose it is not the real private app folder like it is in normal 
>>>>>> Android development. Is it?
>>>>>> Regards
>>>>>>
>>>>>> Il giorno domenica 10 gennaio 2021 alle 03:51:23 UTC+1 Shai Almog ha 
>>>>>> scritto:
>>>>>>
>>>>>>> 1. Yes.
>>>>>>> 2. I guess you could but I never spent any time looking at the 
>>>>>>> generated paths.
>>>>>>>
>>>>>>> On Saturday, January 9, 2021 at 11:07:28 AM UTC+2 P5music wrote:
>>>>>>>
>>>>>>>> 1- Is that private internal app folder accessible (read/write) via 
>>>>>>>> FileSystemStorage?
>>>>>>>> 2-Could the path be created by string concatenations? I mean, you 
>>>>>>>> wrote that the OS gives you that strange absolute path with ID, it 
>>>>>>>> could be 
>>>>>>>> used to just create the needed path. Is it contained in the Document 
>>>>>>>> complete path so to be taken from there with some substring method?
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Il giorno sabato 9 gennaio 2021 alle 07:12:42 UTC+1 Shai Almog ha 
>>>>>>>> scritto:
>>>>>>>>
>>>>>>>>> You can access everything via a native interface. If you have a 
>>>>>>>>> specific path you can open it just fine with FileSystemStorage.
>>>>>>>>>
>>>>>>>>> On Friday, January 8, 2021 at 10:58:38 AM UTC+2 P5music wrote:
>>>>>>>>>
>>>>>>>>>> I need to know if it is possible to access the Library directory. 
>>>>>>>>>> You said that the Document folder is used.
>>>>>>>>>> So is there no chance to have the Library path?
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Il giorno venerdì 8 gennaio 2021 alle 09:08:25 UTC+1 Shai Almog 
>>>>>>>>>> ha scritto:
>>>>>>>>>>
>>>>>>>>>>> We don't determine any paths. We ask the OS for the paths. The 
>>>>>>>>>>> numbers are from iOS itself.
>>>>>>>>>>>
>>>>>>>>>>> On Thursday, January 7, 2021 at 2:44:20 PM UTC+2 P5music wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I found somewhere that the url is something like
>>>>>>>>>>>>
>>>>>>>>>>>> file:///var/mobile/Containers/Data/Application/strangenumberslike...EF22-EB33-4B65-9772-67ED7870E3E9/Library/
>>>>>>>>>>>> where the numbers are ever changing ID for the app, do not care 
>>>>>>>>>>>> about it.
>>>>>>>>>>>>
>>>>>>>>>>>> What can you say about pointing to that path in Codename?
>>>>>>>>>>>> Regards
>>>>>>>>>>>> Il giorno giovedì 7 gennaio 2021 alle 04:05:24 UTC+1 Shai Almog 
>>>>>>>>>>>> ha scritto:
>>>>>>>>>>>>
>>>>>>>>>>>>> Not really but by hacking maybe.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wednesday, January 6, 2021 at 11:11:48 AM UTC+2 P5music 
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Does the user see those files?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Il giorno mercoledì 6 gennaio 2021 alle 04:16:04 UTC+1 Shai 
>>>>>>>>>>>>>> Almog ha scritto:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Storage uses the documents folder on our iOS port. Not sure 
>>>>>>>>>>>>>>> we have that path you're talking about. Most of that code is ~9 
>>>>>>>>>>>>>>> years old 
>>>>>>>>>>>>>>> so I don't recall.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Tuesday, January 5, 2021 at 10:59:09 AM UTC+2 P5music 
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I am talking about Storage, not FileSystemStorage.
>>>>>>>>>>>>>>>> That is the app private folder, not the user data folder.
>>>>>>>>>>>>>>>> I think the iOS Library folder should be inside it.
>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>> Il giorno martedì 5 gennaio 2021 alle 04:18:47 UTC+1 Shai 
>>>>>>>>>>>>>>>> Almog ha scritto:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The first FileSystemStorage root maps to the "Documents" 
>>>>>>>>>>>>>>>>> folder. The second maps to caches and the third root maps to 
>>>>>>>>>>>>>>>>> the resources 
>>>>>>>>>>>>>>>>> dir.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Monday, January 4, 2021 at 9:07:48 PM UTC+2 P5music 
>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> My CodenameOne app is intended for iOS, but I also 
>>>>>>>>>>>>>>>>>> created a native app with XCode.
>>>>>>>>>>>>>>>>>> The two apps should be compatible, in regard to data 
>>>>>>>>>>>>>>>>>> files in the app private folder.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> At present stage the CodenameOne app writes data to the 
>>>>>>>>>>>>>>>>>> main private folder /
>>>>>>>>>>>>>>>>>> while the Swift app uses the following instructions, as 
>>>>>>>>>>>>>>>>>> suggested in the official guidelines, if I am not wrong:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>  let dir = try! FileManager.default.url(for: 
>>>>>>>>>>>>>>>>>> .libraryDirectory, in: .userDomainMask, appropriateFor: nil, 
>>>>>>>>>>>>>>>>>> create: true);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> let fileUrl = 
>>>>>>>>>>>>>>>>>> dir.appendingPathComponent(fileName).appendingPathExtension("json");
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I do not think that the "Library" is the main private 
>>>>>>>>>>>>>>>>>> folder, so I need to understand if it is necessary for the 
>>>>>>>>>>>>>>>>>> CodenameOne app 
>>>>>>>>>>>>>>>>>> to create a subfolder. And what should be the path.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thanks in advance
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/280009cd-cd01-41c1-95a0-236243b83a61n%40googlegroups.com.

Reply via email to