You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/11/22 16:55:30 UTC

[GitHub] [cordova-plugin-file] niccokunzmann edited a comment on issue #263: How to create a FileEntry?

niccokunzmann edited a comment on issue #263: How to create a FileEntry?
URL: https://github.com/apache/cordova-plugin-file/issues/263#issuecomment-557608784
 
 
   I am doing research as this is also my problem.
   
   You can use `DirectoryEntry.getFile()` to create a `FileEntry`
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/www/DirectoryEntry.js#L103
   
   There is `resolveLocalFileSystemURL (uri, onSuccess, onError)`
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/www/resolveLocalFileSystemURI.js#L43
   
   You can create a new FileEntry with these parameters: `name, fullPath, fileSystem, nativeURL`
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/www/Entry.js#L121
   
   There are some hints [here](https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/windows/FileProxy.js#L418):
   ```
       var srcFS = getFilesystemFromURL(src);
       var dstFS = getFilesystemFromURL(parent);
       var srcPath = pathFromURL(src);
       var dstPath = pathFromURL(parent);
   ```
   and [here](https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/windows/FileProxy.js#L457)
   ```
   new FileEntry(
                               name,
                               tgtFsPath,
                               dstFS.name,
                               dstFS.makeNativeURL(tgtFsPath)
   )
   ```
   There are these:
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/windows/FileProxy.js#L914
   
   After looking at this
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/windows/FileProxy.js#L974
   I guess, the parameters look like this for a file in `/directory/file.txt`:
   - name: `file.txt`
   - fullPath: `/directory/file.txt`
   - fileSystem: `fs.name`
   - nativeURL: `fs.makeNativeURL(path)`
   
   There is this:
   ```
   var fs = getFilesystemFromURL(url);
   var path = pathFromURL(url);
   ```
   https://github.com/apache/cordova-plugin-file/blob/5e12b5e9f63b12aef5198e9a72ac8d7b8e834442/src/windows/FileProxy.js#L1004

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org