"permissions": {
"device-storage:videos":{ "access": "readonly" },
"device-storage:pictures":{ "access": "readwrite" }
let rename_file = function (filepath, filename, storage) {
window_status = "rename";
let sdcard = navigator.getDeviceStorages("sdcard");
let request = sdcard[storage].get(filepath);
request.onsuccess = function () {
let fileget = this.result;
let filetype = fileget.type;
let file_extension = fileget.name.split(".");
file_extension = file_extension[file_extension.length - 1];
let filepath_mod = filepath.replace(filename, "");
let newfilename = prompt(lang[user_lang].rename, "");
let requestAdd = sdcard[storage].addNamed(
fileget,
filepath_mod + newfilename + "." + file_extension
);
requestAdd.onsuccess = function () {
var request_del = sdcard[storage].delete(filepath);
request_del.onsuccess = function () {
// success copy and delete
};
request_del.onerror = function () {
// success copy not delete
alert("Unable to remove the file: " + this.error);
};
};
requestAdd.onerror = function () {
alert("Unable to write the file: " + this.error);
};
};
request.onerror = function () {
alert(this.error);
};
};