title: $cordovaFile checkFile() to see if a file that’s in the www folder exists?
body: <p>I've placed a folder called <code>kml</code> inside the <code>www</code> folder of my Ionic project. I want to see if a file exists in that <code>kml</code> folder but I'm not sure which path I should use. Currently, I've only tested this for iOS (simulator and real device) and I've used all the iOS paths and it still can't find the KML file even though it's there.</p>
  
  <p>Below shows exactly where I placed the <code>kml</code> folder:</p>
  
  <p><a href="https://i.stack.imgur.com/jBPL3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jBPL3.png" alt="enter image description here"></a></p>
  
  <p>Below is how I programmatically try to check if a KML file exists.</p>
  
  <pre><code>$cordovaFile.checkFile(cordova.file.applicationStorageDirectory, $stateParams.kml_file)
  .then(function (success) {
    // success
    console.log("kml file found");
    console.log(success);
  }, function (error) {
    // error
    console.log("kml file NOT found");
    console.log(error);
  });
  </code></pre>
  
  <p>Other than the fact that I know the KML file exists in the <code>www/kml</code> folder because I put it there, I open the KML file using <code>geoXML3</code> library and load it to a google map successfully. </p>
  
  <p>That is currently separate from checking if the file exists, <strong>which is why I need to know if the KML file exists before hand</strong> before I try to parse it with <code>geoXML3</code> and load it to the map. But I don't know the correct <code>path</code>. </p>
  
  <p>I've used all of the suggested iOS path from <a href="http://ngcordova.com/docs/plugins/file/" rel="nofollow noreferrer">http://ngcordova.com/docs/plugins/file/</a> Namely: <code>applicationDirectory</code>, <code>documentsDirectory</code>, <code>dataDirectory</code>, <code>cacheDirectory</code> and <code>tempDirectory</code>. But the file can't be found with all of them. I get "kml file NOT found" in the console in Xcode and the error <code>{"code":1,"message":"NOT_FOUND_ERR"}</code></p>