android - GetFile Cordova 3.4.0 err.code 1000 -
i try getfile cordova 3.4.0 :
filemanager.prototype.readastextfromfile = function (filename, readdatacallback) { var = this; try { window.requestfilesystem(localfilesystem.persistent, 0, function (filesystem) { filesystem.root.getfile(filename, {create: false}, function (fileentry) { fileentry.file( function (file){ var reader = new filereader(); reader.onloadend = readdatacallback; reader.readastext(file); } , function(err){alert('readfile' + " fail: " + err.code);}); } , function(err){alert('getfile' + " fail: " + err.code);}); }, function(err){alert('filesystem' + " fail: " + err.code);}); } catch (e) { logerror(e); } }
but obtain err.code 1000 on call getfile.
the file name :
var filename = "/scard/" + reliefssubfoldername + reliefname + string.fromcharcode(47) + reliefsmanifestfilename;
/scard/my_dir_on_card/my_file_name.drd (drd extension text file)
may know correct way achieve objective?
i guess need omit leading "/" filename.
possible cause of error code 1000 non-existent path file while geting reference through getfile create option false
filesystem.root.getfile(filename, {create: false},...
you may try inspect full file path before invoking getfile , see if valid. path should not contain multiple consecutive "/" other initial protocol. e.g cdvfile://localhost/persistent/scard.....
console.log(filesystem.root.tourl() + filename);
Comments
Post a Comment