Github user dpeacock commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/81#discussion_r17681983
  
    --- Diff: src/android/LocalFilesystem.java ---
    @@ -579,6 +582,7 @@ public long writeToFileAtURL(LocalFilesystemURL 
inputURL, String data,
                        // Always close the output
                        out.close();
                 }
    +                   broadcastNewFile(inputURL);
    --- End diff --
    
    I agree with what you are saying here.  By the time we are in 
writeToFileAtURL it seems the file already exists, so I tried moving this logic 
to getFileForLocalURL.  In here I was checking if the file existed prior to 
creation, then broadcasting if it was created.  
    
    The results however were strange.  Though the files would appear, they 
would sometimes be 0 bytes in size.  Trying to debug the javascript portion 
always resulted in 0 byte files.
    
    I then tried re-testing the broadcast after the write (where it is in this 
commit) and it seems to work as expected.  I can't really explain why this 
occurring, perhaps you have some insight on this?  If not, I think it's 
probably best to leave the broadcast after every write to be safe.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to