kosbou
kosbou

Reputation: 3999

Cannot create directory with Cordova file plugin

I use the below code in order to create Folder_Name directory in android cordova project with no luck

   writeFile();

function writeFile() {
    console.log(cordova.file.externalRootDirectory);
    window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(fileSystem){
        var entry = "";
            entry = fileSystem;
       console.log(entry);
        entry.getDirectory("Folder_Name", {
            create: true
        }, onGetDirectorySuccess, onGetDirectoryFail);
    }, onError);
}

function onError(e) {
    alert("onError");
};

function onGetDirectoryFail(dir) {
    console.log("directory does not created!!!!!");
};

function onGetDirectorySuccess(dir) {
    console.log("directory created.");
};

Where am I wrong?

Upvotes: 0

Views: 692

Answers (0)

Related Questions