From ee433772f219a39d4f62e06e551cf7b0486c516e Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 29 Dec 2023 23:12:56 +0300 Subject: [PATCH] Comment read and exist fs functions --- www/js/plugins/CordovaFixes.js | 82 +++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/www/js/plugins/CordovaFixes.js b/www/js/plugins/CordovaFixes.js index 17e63e4..3f5f169 100644 --- a/www/js/plugins/CordovaFixes.js +++ b/www/js/plugins/CordovaFixes.js @@ -247,50 +247,50 @@ document.addEventListener("deviceready", () => { return true; }; - NativeFunctions.saveFileExists = function(path) { - var split_path = require.libs.path._solve_dots(path).split("/"); - save_exists = null; - window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) { - console.log(`Using externalStorage while checking save file ${path} existence`); - dirEntry.getDirectory(split_path[0], { create: true }, function (subDirEntry) { - subDirEntry.getFile(split_path[1], {create: false, exclusive: false}, function(fileEntry) { - save_exists = true; - console.log(`After "save_exists = true" - ${save_exists}`); - }, () => { - save_exists = false; - console.log(`After "save_exists = false" - ${save_exists}`); - }); - }); - }); - console.log(`Before return - ${save_exists}`); - return save_exists; - } + // NativeFunctions.saveFileExists = function(path) { + // var split_path = require.libs.path._solve_dots(path).split("/"); + // save_exists = null; + // window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) { + // console.log(`Using externalStorage while checking save file ${path} existence`); + // dirEntry.getDirectory(split_path[0], { create: true }, function (subDirEntry) { + // subDirEntry.getFile(split_path[1], {create: false, exclusive: false}, function(fileEntry) { + // save_exists = true; + // console.log(`After "save_exists = true" - ${save_exists}`); + // }, () => { + // save_exists = false; + // console.log(`After "save_exists = false" - ${save_exists}`); + // }); + // }); + // }); + // console.log(`Before return - ${save_exists}`); + // return save_exists; + // } - NativeFunctions.readSaveFileUTF8 = function(path, fnCallback) { - var split_path = require.libs.path._solve_dots(path).split("/"); - save_data = null; - window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) { - console.log(`Using externalStorage to read save at ${path}`); - dirEntry.getDirectory(split_path[0], { create: true }, function (subDirEntry) { - subDirEntry.getFile(split_path[1], {create: false, exclusive: false}, function(fileEntry) { - fileEntry.file(function (file) { - var reader = new FileReader(); + // NativeFunctions.readSaveFileUTF8 = function(path, fnCallback) { + // var split_path = require.libs.path._solve_dots(path).split("/"); + // save_data = null; + // window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) { + // console.log(`Using externalStorage to read save at ${path}`); + // dirEntry.getDirectory(split_path[0], { create: true }, function (subDirEntry) { + // subDirEntry.getFile(split_path[1], {create: false, exclusive: false}, function(fileEntry) { + // fileEntry.file(function (file) { + // var reader = new FileReader(); - reader.onloadend = function() { - save_data = this.result; - }; + // reader.onloadend = function() { + // save_data = this.result; + // }; - reader.readAsText(file); - }, () => { - console.log("Error to read external save file: " + e.toString()); - }); - }, (e) => { - console.log("Error to find external save file: " + e.toString()); - }); - }); - }); - return save_data; - } + // reader.readAsText(file); + // }, () => { + // console.log("Error to read external save file: " + e.toString()); + // }); + // }, (e) => { + // console.log("Error to find external save file: " + e.toString()); + // }); + // }); + // }); + // return save_data; + // } NativeFunctions.writeSaveFileUTF8 = function(path, data) { var split_path = require.libs.path._solve_dots(path).split("/");