iOS Failed to create directory (can ios handle chinese in paths??)

18 views
Skip to first unread message

Gareth Murfin

unread,
Jan 13, 2019, 12:14:46 AM1/13/19
to CodenameOne Discussions
My app works on simulator and android, it extracts a zip to FileSystemStorage, however it fails on ios and I see this error:

<Notice>: Failed to create directory /var/mobile/Containers/Data/Application/B8F1A094-A60C-4D14-A155-B5C141924EE4/Documents/com.outlier.lang///extracted/html-data/entries/kanji/\M-h\M^R\M-&/

The paths actually contain chinese characters, which I assume is the issue, but seems odd that it works fine on android and simulator.. Does anyone know if its possible to write folders/files with chinese characters on ios ?

Shai Almog

unread,
Jan 13, 2019, 1:07:24 AM1/13/19
to CodenameOne Discussions
I think this might be related to the three /// characters. How did you generate that path?

Gareth Murfin

unread,
Jan 13, 2019, 2:48:07 AM1/13/19
to CodenameOne Discussions
Thanks Shai, so it seems to not have errors now, but im still having problems, 

My html is generated fine as you can see my log it seems to work:

Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,632 - \134^[[32m####StateMachine 0// HTML GENERATED OK.
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,635 - \134^[[32m####StateMachine =====ADD MEANING TREE=====
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,638 - \134^[[32m####StateMachine opening file @ file:///var/mobile/Containers/Data/Application/CE84D04B-4428-4BF9-A8B6-2F34A0CCDD5A/Documents/com.outlier.lang/extracted/html-data/entries/kanji/\M-f\M^[\M-=/\M-f\M^[\M-=-meaning-tree-k.html
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,644 - \134^[[32m####StateMachine html loaded is ->
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,647 - \134^[[32m####StateMachine 
<HTML><BODY><!-- form_explanation -->
<HR><P><FONT SIZE=5 COLOR=RED><B>FORM EXPLANATION</B></FONT><P><HR>
<body>
<p>Ancient form:<br />
<br />
<img src="2304.svg" style="width:15.0%" /></p>
<p>\M-f\M^[\M-= depicts a cooking vessel used for steaming food, indicating its <a href="../../../key-concepts-kanji/original-meaning.html">original meaning</a> \M-b\M^@\M^\cookware used to steam food.\M-b\M^@\M^]<br />
[<a href="../../../references/\M-f\M^]\M^N\M-e\M--\M-8\M-e\M^K\M-$-\M-e\M--\M^W\M-f\M-:\M^P.html">Reference</a>, p. 54]</p>
</body>
</BODY></HTML><!-- meaning_tree -->
<HR><P><FONT SIZE=5 COLOR=RED><B>MEANING TREE</B></FONT><P><HR>
<body>
<p>J\M-E\M^My\M-E\M^M kanji, taught in high school</p>
<p>JLPT level</p>
<h4 id="character-meanings"><a href="../../../key-concepts-kanji/character-meaning.html">Character meanings</a></h4>
<ol>
<li>(<a href="../../../key-concepts-kanji/original-meaning.html">orig.</a>) cookware used to steam food</li>
<li>\M-b\M^F\M^R formerly, once, before</li>
<li>\M-b\M^F\M^R former, past, ex\M-b\M^@\M-&</li>
<li>\M-b\M^F\M^R ever, never</li>
</ol>
<h<\M-b\M^@\M-&>
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,653 - \134^[[32m####StateMachine 1// HTML GENERATED OK.
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,658 - \134^[[32m####StateMachine writing file @ file:///var/mobile/Containers/Data/Application/CE84D04B-4428-4BF9-A8B6-2F34A0CCDD5A/Documents/com.outlier.lang/extracted/html-data/entries/kanji/\M-f\M^[\M-=/gen.html
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: [EDT] 0:4:15,663 - \134^[[32m####StateMachine And now viewing our generated file..

but when I visit it inside my app I see this error (app freezes then eventually exits):

 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>: Memory usage info dump at MainFrameLoadStarted:
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   internal: 108318720
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   compressed: 18063360
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   document_count: 1
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   virtual_size: 2219409408
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   phys_footprint: 111435776
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   pagecache_page_count: 0
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   javascript_gc_heap_extra_memory_size: 0
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   resident_size: 272510976
 Jan 13 15:42:07 USERs-iPhone MyApplication(WebCore)[1711] <Notice>:   javascript_gc_heap_capacity: 65536
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11
 Jan 13 15:42:07 USERs-iPhone MyApplication[1711] <Notice>: We had a signal 11

Gareth Murfin

unread,
Jan 13, 2019, 3:24:34 AM1/13/19
to CodenameOne Discussions
hmm when i print the contents of storage only cn1preferences and cnlog exist, its as if ios is wiping or not letting me write any files at all..

i really hate iphone.

Gareth Murfin

unread,
Jan 13, 2019, 3:53:54 AM1/13/19
to CodenameOne Discussions
basically nothing will save to the iphone, you can see if fails to make any directory, im using a normal test zip no weird characters but still it wont write, works perfectly on android and sim. im so confused right now, wasted entire day on this.

 Jan 13 16:50:20 USERs-iPhone assertiond[66] <Notice>: -[BKAssertion dealloc] - <0x1015452f0>
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,407 - \134^[[32m####ZipTools Unzip
 Jan 13 16:50:20 USERs-iPhone symptomsd(SymptomEvaluator)[1324] <Notice>: L2 Metrics on ifname en0: rssi: -41 (txFrames/txReTx/txFail) 0/0/0 -> (was/is) 0/0
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,419 - \134^[[32m####ZipTools unzipping to /gaztest
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,429 - \134^[[32m####ZipTools mkdir ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,438 - \134^[[32m####ZipTools mkdir ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/a/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/a/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,448 - \134^[[32m####ZipTools writing ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/a/test.txt
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,456 - \134^[[32m####ZipTools mkdir ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/b/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/b/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,464 - \134^[[32m####ZipTools writing ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/b/test.txt
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,471 - \134^[[32m####ZipTools mkdir ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/c/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/c/
 Jan 13 16:50:20 USERs-iPhone MyApplication[1940] <Notice>: [EDT] 0:0:27,478 - \134^[[32m####ZipTools writing ---> file:/var/mobile/Containers/Data/Application/419F9A77-DD75-417E-A3DC-D60E25EF58DA/Documents/com.outlier.lang/gaztest/testzipfolder/c/test.txt

Gareth Murfin

unread,
Jan 13, 2019, 4:23:17 AM1/13/19
to CodenameOne Discussions
Well im now coming to the conclusion there must be some sort of bug in cn1 which will not allow writing to iphone storage. 10 hours of trying with no luck, and no clue what to do next, have you ever tried unzipping to FileSystemStorage on an iphone? im using cn1 zipsupport.

Gareth Murfin

unread,
Jan 13, 2019, 5:01:17 AM1/13/19
to CodenameOne Discussions

OK so I did a quick test bed to show my issue, and it seems to prove that somehow you cannot unzip on iphone

steps
1-new project
2-in start() put this code 

        System.out.println("TEST ZIP ON IPHONE");
        InputStream zipFile = Display.getInstance().getResourceAsStream(Form.class, "/testzipfolder.zip");
        Unzip(zipFile, "extractedtest");
 
        String filesFoundx="";//for debug
        for(String file : Storage.getInstance().listEntries()) 
        {
            filesFoundx+=file+"\n";
        }        
        Dialog.show("DEBUG",filesFoundx, "Ok", null);        
        
use this unzip method, this works on android/sim, Its not quite same as the one on the zipsupport github page because that code doesnt work correctly (if this method is somehow wrong here id like to know why but seems to work fine)

public static void Unzip(InputStream is_zipFile, String str_dirDest) 
    {
   
        InputStream is;
        try 
        {
            is = is_zipFile;
            ZipInputStream zipStream = new ZipInputStream(is);
            ZipEntry entry;

            // create a buffer to improve copy performance later.
            byte[] buffer = new byte[2048];
         
            while ((entry = zipStream.getNextEntry()) != null) 
            {
                FileSystemStorage fs = FileSystemStorage.getInstance();
                String str_name = entry.getName();
                String str_outdir = FileSystemStorage.getInstance().getAppHomePath();
                
                if (str_outdir.length() > 0) 
                {
                    str_outdir = str_outdir + "/" + str_dirDest;
                }
                
                String outpath = str_outdir + "/" + entry.getName();
                OutputStream output = null;
                try 
                {
                    if (entry.isDirectory()) 
                    {
                        fs.mkdir(str_outdir + "/" + str_name);
                        continue;
                    } 
                    else 
                    {
                        File file = new File(str_outdir + File.separator + str_name);
                        File parent = file.getParentFile();
                        if (!parent.exists()) 
                        {
                            parent.mkdirs();
                        }
                    }
                 
                    output = FileSystemStorage.getInstance().openOutputStream(outpath);
                    int len = 0;
                    while ((len = zipStream.read(buffer)) > 0) 
                    {
                        output.write(buffer, 0, len);
                    }
                } 
                catch (Exception e) 
                {
                    e.printStackTrace();
                 
                    Dialog.show("Unzipping Error!", ""+e.getMessage(), "OK", null);
                } 
                finally 
                {
                    if (output != null) 
                    {
                        output.close();
                    }
                }
            }
        } catch (IOException ex) {
            Log.p(ex.getMessage(), 0);
          
            Dialog.show("Unzipping Error!", ""+ex.getMessage(), "Ok", null);
        }
       
    }


- run on simulator observe dialog shows "extractedtest" dir has been made
- run on iphone, observe it is not there (and errors making dirs)

output:

Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: TEST ZIP ON IPHONE
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: 
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/D78A74D3-67AD-4BB0-893B-8EDA6454C6E6/Documents/com.outlier.lang//extractedtest/testzipfolder/
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/D78A74D3-67AD-4BB0-893B-8EDA6454C6E6/Documents/com.outlier.lang//extractedtest/testzipfolder/a/
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/D78A74D3-67AD-4BB0-893B-8EDA6454C6E6/Documents/com.outlier.lang//extractedtest/testzipfolder/b/
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/D78A74D3-67AD-4BB0-893B-8EDA6454C6E6/Documents/com.outlier.lang//extractedtest/testzipfolder/c/
 Jan 13 17:58:12 USERs-iPhone MyApplication[1977] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/D78A74D3-67AD-4BB0-893B-8EDA6454C6E6/Documents/cn1storage/

Gareth Murfin

unread,
Jan 13, 2019, 5:14:04 AM1/13/19
to CodenameOne Discussions
and the test zip i made https://ufile.io/1c91l

Shai Almog

unread,
Jan 13, 2019, 10:21:29 PM1/13/19
to CodenameOne Discussions
Try:

if(str_outdir.endsWith("/")) {
    fs.mkdir(str_outdir + str_name);
} else {
    fs.mkdir(str_outdir + "/" + str_name);
}

Also check that str_name doesn't include / within it. You can test both in the simulator but failure will probably only show on the device as it's more sensitive to these nuances.

Gareth Murfin

unread,
Jan 16, 2019, 2:58:41 AM1/16/19
to CodenameOne Discussions
thanks shai.. no luck unfortunately, i made sure there was no /// 

but i still see 
Failed to create directory /var/mobile/Containers/Data/Application/4B8FF26A-77E4-473E-A4A8-4D2D6F119B26/Documents/com.outlier.lang/gaztest/testzipfolder/

I even wrote a simple test to simply make a dir, but it always fails on iphone, it is as if you cannot make dirs on iphone at all.. but surely someone would have noticed by now... 

this code 

  FileSystemStorage fs = FileSystemStorage.getInstance();
        fs.mkdir("ZZZTESTA");
        fs.mkdir("ZZZTESTB");
        String testpath = fs.getAppHomePath()+"/xxxtesta";
        fs.mkdir(testpath);
         String testpathb = fs.getAppHomePath()+"xxxtestb";
        fs.mkdir(testpathb);

results in 

 Jan 16 15:53:15 USERs-iPhone MyApplication[2388] <Notice>: Failed to create directory ZZZTESTA
 Jan 16 15:53:15 USERs-iPhone MyApplication[2388] <Notice>: Failed to create directory ZZZTESTB
 Jan 16 15:53:15 USERs-iPhone MyApplication[2388] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/F0E3CD3E-F560-4E5A-987B-5A89CA79EB85/Documents/com.outlier.lang//xxxtesta
 Jan 16 15:53:15 USERs-iPhone MyApplication[2388] <Notice>: Failed to create directory /var/mobile/Containers/Data/Application/F0E3CD3E-F560-4E5A-987B-5A89CA79EB85/Documents/com.outlier.lang/xxxtestb

completely ridiculous. 

Gareth Murfin

unread,
Jan 16, 2019, 5:25:25 AM1/16/19
to CodenameOne Discussions
files dont even write on ios, im assuming this is a cn1 one bug by now. 

 try
        {
            String root = FileSystemStorage.getInstance().getAppHomePath();
            OutputStream os = FileSystemStorage.getInstance().openOutputStream(root+"testfile.txt");
            os.write("arse".getBytes());
            _("arse written");
            _("does it exist? "+FileSystemStorage.getInstance().exists(root+"testfile.txt"));
            
        }
        catch(Exception e)
        {
            _("cant write file "+e.getMessage());
        }

####StateMachine arse written
 ####StateMachine does it exist? false

Gareth Murfin

unread,
Jan 16, 2019, 5:42:31 AM1/16/19
to CodenameOne Discussions
its weird because i just tried and rebuilt another app ive done in cn1, it downloads pdfs to fileststemstorage, that work fine still

it uses 

 Util.downloadUrlToFileSystemInBackground(url, FileSystemStorage.getInstance().getAppHomePath()+savedFileName, new ActionListener(){
                @Override
                public void actionPerformed(ActionEvent evt) {
                    _("%%%%%%%%%%%%PDF download complete%%%%%%%%%%%%%%%");
                }
            }); 

Shai Almog

unread,
Jan 16, 2019, 10:35:39 PM1/16/19
to CodenameOne Discussions
You didn't close os in the file writing test.
Reply all
Reply to author
Forward
0 new messages