$cordovaFile checkFile() to see if a file that's in the www folder exists?

I’ve placed a folder called kml inside the www folder of my Ionic project. I want to see if a file exists in that 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.

Below shows exactly where I placed the kml folder:

image

Below is how I programmatically try to check if a KML file exists.

.controller('SomeCtrl', function($scope, $stateParams, $cordovaFile) {
    $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);
      });
  });

Other than the fact that I know the KML file exists in the www/kml folder because I put it there, I open the KML file using geoXML3 library and load it to a google map successfully.

That is currently separate from checking if the file exists, which is why I need to know if the KML file exists before hand before I try to parse it with geoXML3 and load it to the map. But I don’t know the correct path.

I’ve used all of the suggested iOS path from http://ngcordova.com/docs/plugins/file/ Namely: applicationDirectory, documentsDirectory, dataDirectory, cacheDirectory and tempDirectory. But I 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":1,"message":"NOT_FOUND_ERR"}

Did you figure this out? Is it cordova.file.applicationDirectory + “img/fileName.png” ? Or…