Skip to content

FileManager.resolveLocalFileSystemURL

Kerri Shotts edited this page Apr 4, 2014 · 1 revision

(part of FileManager)

Parameters:

  • theURL - an absolute or relative path to the file or directory (including filename)

Returns: Promise, resolving to the file or directory entry

ASYNCHRONOUS

Given a file://path/to/file, this method resolves the file to the local file system using window.resolveLocalFileSystemURL. However the method does some massaging of the input URL first.

  • If the URL does not specify a file URL scheme, it is assumed.
  • If the URL specifies some URL scheme other than file, it is not overridden (though it will probably fail).
  • If the path has /private as the first entry, it is removed. This deals with the fact that even though a path may be in our app's sandbox, iOS still refuses permission to the directory. Remove /private, and the resulting path is acceptable.
  • If the path has more than one colon, an error is thrown, as it appears to have more than one scheme.

Usage

aFileManager.resolveLocalFileSystemURL ( "/path/to/file.txt" )
            .then ( function ( theEntry ) { ... } )
            .catch ( function ( e ) { console.log ( e ); }
            .done ();
Clone this wiki locally