TagSpaces is an offline, open source, document manager with tagging support
api refactorings
uggrockb1e977959744
diff --git a/data/chromium/chrome.api.js b/data/chromium/chrome.api.jsindex f26264bb8..22060c8df 100644--- a/data/chromium/chrome.api.js+++ b/data/chromium/chrome.api.js@@ -414,10 +414,13 @@ define(function(require, exports, module) {TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openFileNativelyAlert"));};- exports.handleStartParameters = handleStartParameters;+ // Platform specific callsexports.checkAccessFileURLAllowed = checkAccessFileURLAllowed;- exports.focusWindow = focusWindow;exports.saveSettings = saveSettings;++ // Platform API+ exports.handleStartParameters = handleStartParameters;+ exports.focusWindow = focusWindow;exports.checkNewVersion = checkNewVersion;exports.createDirectoryIndex = createDirectoryIndex;diff --git a/data/cordova/cordova.api.js b/data/cordova/cordova.api.jsindex 7bb95318f..75cf394d4 100644--- a/data/cordova/cordova.api.js+++ b/data/cordova/cordova.api.js@@ -20,9 +20,13 @@ define(function(require, exports, module) {var appSettingFile = "settings.json";var appSettingTagsFile = "settingsTags.json";+ var anotatedTree;+ var pendingCallbacks = 0;+document.addEventListener("deviceready", onDeviceReady, false);document.addEventListener("resume", onDeviceResume, false);document.addEventListener("initApp", onApplicationLoad, false);+// Register ios file open handlerhandleOpenURL = function(url) {var fileName = url.substring(url.lastIndexOf('/') + 1, url.length);@@ -31,7 +35,19 @@ define(function(require, exports, module) {});};- // Cordova loaded and can be used+ // Platform specific functions+ function normalizePath(path) {+ //we set absoilute path because some extensions didn't recognize cdvfile+ //but in cordova.api implementation we didn't need absolute path so we strip nativeURL+ if (path.indexOf(fsRoot.nativeURL) === 0) {+ path = path.replace(fsRoot.nativeURL , "/");+ }+ if (path.indexOf(fsRoot.fullPath) === 0) {+ path = path.substring(fsRoot.fullPath.length, path.length);+ }+ return path;+ }+function onDeviceReady() {console.log("Device Ready:"); // "+device.platform+" - "+device.version);// Redefining the back button@@ -114,14 +130,6 @@ define(function(require, exports, module) {}}- var handleStartParameters = function() {- if (urlFromIntent !== undefined && urlFromIntent.length > 0) {- console.log("Intent URL: " + urlFromIntent);- var filePath = decodeURIComponent(urlFromIntent);- TSCORE.FileOpener.openFileOnStartup(filePath);- }- };-function getFileSystemPromise(path) {console.log("getFileSystemPromise: " + path);if(path.indexOf(cordova.file.applicationDirectory) === 0) {@@ -138,6 +146,19 @@ define(function(require, exports, module) {});}+ function resolveFullPath(localURL) {+ //Cordova file plugin didn't set fullpath so we set fullpath as absolute+ //this solve problem with extensions which can't use the cdvfile+ var URL = "cdvfile://localhost/persistent/";+ var fullPath = decodeURIComponent(localURL);+ if (fullPath.indexOf("cdvfile://localhost/root/") === 0) {+ URL = "cdvfile://localhost/root/";+ }++ fullPath = fsRoot.nativeURL + fullPath.substring(URL.length, fullPath.length);+ return fullPath;+ }+function getAppStorageFileSystem(fileName, fileCallback, fail) {var dataFolderPath = (isCordovaiOS === true) ?cordova.file.dataDirectory : cordova.file.externalApplicationStorageDirectory;@@ -201,6 +222,7 @@ define(function(require, exports, module) {}function saveSettings(settings) {+ //saveSettingsFile(appSettingFile, settings);}@@ -261,57 +283,42 @@ define(function(require, exports, module) {);}- function getFileContent(fullPath, result, error) {- getFile(fullPath, function(file) {- var reader = new FileReader();- reader.onerror = function() {- error(reader.error);- };- reader.onload = function() {- result(reader.result);- };- reader.readAsArrayBuffer(file);- }, error);- }+ // Platform API+ function focusWindow() {+ // Bring the TagSpaces window on top of the windows+ console.log("Focusing window is not implemented in cordova.");+ };- function getFilePromise(filePath, resolvePath) {- return new Promise(function(resolve, reject) {- if (resolvePath) {- getFileSystemPromise(resolvePath).then(function(resfs) {- resfs.getFile(filePath, {create: false},- function(fileEntry) {- fileEntry.file(resolve, reject);- },- reject- );- }).catch(reject);- } else {- getFile(filePath, resolve, reject);- }- });- }+ function handleStartParameters() {+ if (urlFromIntent !== undefined && urlFromIntent.length > 0) {+ console.log("Intent URL: " + urlFromIntent);+ var filePath = decodeURIComponent(urlFromIntent);+ TSCORE.FileOpener.openFileOnStartup(filePath);+ }+ };- function getFileContentPromise(filePath, type, resolvePath) {+ function sendFile(filePath) {+ console.log("Sending file: " + filePath);+ window.plugins.fileOpener.send(filePath);+ };- return new Promise(function(resolve, reject) {- getFilePromise(filePath, resolvePath).then(function(file) {- var reader = new FileReader();- reader.onerror = function() {- reject(reader.error);- };- reader.onload = function() {- resolve(reader.result);- };- if (type === "text") {- reader.readAsText(file);- } else {- reader.readAsArrayBuffer(file);- }- }, reject);- });- }+ function checkNewVersion() {+ console.log("Checking for new version...");+ var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;+ $.ajax({+ url: 'http://tagspaces.org/releases/version.json?pVer=' + cVer,+ type: 'GET'+ })+ .done(function(data) {+ TSPOSTIO.checkNewVersion(data);+ })+ .fail(function(data) {+ console.log("AJAX failed " + data);+ });+ };- var createDirectoryIndex = function(dirPath) {++ function createDirectoryIndex(dirPath) {TSCORE.showWaitingDialog($.i18n.t("ns.common:waitDialogDiectoryIndexing"));var directoryIndex = [];@@ -360,103 +367,70 @@ define(function(require, exports, module) {}}- var anotatedTree;- var pendingCallbacks = 0;- var createDirectoryTree = function(dirPath) {+ function createDirectoryTree(dirPath) {console.log("Creating directory index for: " + dirPath);TSCORE.showAlertDialog("Creating directory tree is not supported in Cordova yet.");};- function normalizePath(path) {- //we set absoilute path because some extensions didn't recognize cdvfile- //but in cordova.api implementation we didn't need absolute path so we strip nativeURL- if (path.indexOf(fsRoot.nativeURL) === 0) {- path = path.replace(fsRoot.nativeURL , "/");- }- if (path.indexOf(fsRoot.fullPath) === 0) {- path = path.substring(fsRoot.fullPath.length, path.length);- }- return path;- }-- var checkNewVersion = function() {- console.log("Checking for new version...");- var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;- $.ajax({- url: 'http://tagspaces.org/releases/version.json?pVer=' + cVer,- type: 'GET'- })- .done(function(data) {- TSPOSTIO.checkNewVersion(data);- })- .fail(function(data) {- console.log("AJAX failed " + data);- });- };-- var listSubDirectories = function(dirPath) {- console.log("Listing sub directories of: " + dirPath);- // directory path format DCIM/Camera/ !- if (dirPath.lastIndexOf("/") === 0 || dirPath.lastIndexOf("/") != dirPath.length - 1) {- dirPath = dirPath + "/"; // TODO make it platform independent- }-- dirPath = normalizePath(dirPath);- console.log("Listing sub directories of : " + dirPath + " normalized.");- TSCORE.showLoadingAnimation();-- fsRoot.getDirectory(dirPath, {- create: false,- exclusive: false- },- function(dirEntry) {- var directoryReader = dirEntry.createReader();- // Get a list of all the entries in the directory- directoryReader.readEntries(- function(entries) {- var i;- var anotatedDirList = [];- for (i = 0; i < entries.length; i++) {+ function listDirectoryPromise(path){+ return new Promise(function(resolve, reject) {+ var anotatedDirList = [];+ var fileWorkers = [];+ getFileSystemPromise(path).then(function(fileSystem) {+ var reader = fileSystem.createReader();+ reader.readEntries(+ function (entries) {+ for (var i = 0; i < entries.length; i++) {if (entries[i].isDirectory) {anotatedDirList.push({"name": entries[i].name,- "path": entries[i].fullPath+ "path": entries[i].fullPath,+ "isFile": false,+ "size": "",+ "lmdt": ""+ });+ } else {+ var filePromise = Promise.resolve({+ then: function(resolve, reject) {+ if(entries[i] && entries[i].isFile) {+ entries[i].file(function(entry) {+ resolve({+ "name": entry.name,+ "isFile": true,+ "size": entry.size,+ "lmdt": entry.lastModifiedDate,+ "path": entry.fullPath+ });+ }, function(err) {+ console.log("Error reading entry " + entry.name);+ }+ );+ }+ }});+ fileWorkers.push(filePromise);}}- //console.log("Dir content: " + JSON.stringify(entries));- TSPOSTIO.listSubDirectories(anotatedDirList, dirPath);+ Promise.all(fileWorkers).then(function(values) {+ if(values.length > 0) {+ anotatedDirList = anotatedDirList.concat(values);+ }+ resolve(anotatedDirList);+ });},- function(error) { // error get file system- //TSPOSTIO.errorOpeningPath(dirPath);- TSCORE.hideLoadingAnimation();- console.error("Listing sub directories failed: " + error.code);+ function (err) {+ reject(err);});- },- function(error) {- //TSPOSTIO.errorOpeningPath(dirPath);- TSCORE.hideLoadingAnimation();- console.error("Getting sub directories of : " + dirPath + " failed: " + error.code);+ }, function (err) {+ reject(err);}- );- };-- function resolveFullPath(localURL) {- //Cordova file plugin didn't set fullpath so we set fullpath as absolute- //this solve problem with extensions which can't use the cdvfile- var URL = "cdvfile://localhost/persistent/";- var fullPath = decodeURIComponent(localURL);- if (fullPath.indexOf("cdvfile://localhost/root/") === 0) {- URL = "cdvfile://localhost/root/";- }-- fullPath = fsRoot.nativeURL + fullPath.substring(URL.length, fullPath.length);- return fullPath;+ );+ });}- var listDirectory = function(dirPath, callback, fs) {+ function listDirectory(dirPath, callback, fs) {TSCORE.showLoadingAnimation();// directory path format DCIM/Camera/ !@@ -565,11 +539,16 @@ define(function(require, exports, module) {);};- var getDirectoryMetaInformation = function(dirPath, readyCallback) {- console.log("getDirectoryMetaInformation directory: " + dirPath);- dirPath = dirPath + "/"; // TODO make it platform independent+ function listSubDirectories(dirPath) {+ console.log("Listing sub directories of: " + dirPath);+ // directory path format DCIM/Camera/ !+ if (dirPath.lastIndexOf("/") === 0 || dirPath.lastIndexOf("/") != dirPath.length - 1) {+ dirPath = dirPath + "/"; // TODO make it platform independent+ }+dirPath = normalizePath(dirPath);- var anotatedDirList = [];+ console.log("Listing sub directories of : " + dirPath + " normalized.");+ TSCORE.showLoadingAnimation();fsRoot.getDirectory(dirPath, {create: false,@@ -577,24 +556,68 @@ define(function(require, exports, module) {},function(dirEntry) {var directoryReader = dirEntry.createReader();++ // Get a list of all the entries in the directorydirectoryReader.readEntries(function(entries) {var i;- var normalizedPath;+ var anotatedDirList = [];for (i = 0; i < entries.length; i++) {- if (entries[i].isFile) {- entries[i].file(- function(entry) {- if (!entry.fullPath) {- entry.fullPath = resolveFullPath(entry.localURL);- }- anotatedDirList.push({- "name": entry.name,- "isFile": true,- "size": entry.size,- "lmdt": entry.lastModifiedDate,- "path": entry.fullPath- });+ if (entries[i].isDirectory) {+ anotatedDirList.push({+ "name": entries[i].name,+ "path": entries[i].fullPath+ });+ }+ }+ //console.log("Dir content: " + JSON.stringify(entries));+ TSPOSTIO.listSubDirectories(anotatedDirList, dirPath);+ },+ function(error) { // error get file system+ //TSPOSTIO.errorOpeningPath(dirPath);+ TSCORE.hideLoadingAnimation();+ console.error("Listing sub directories failed: " + error.code);+ }+ );+ },+ function(error) {+ //TSPOSTIO.errorOpeningPath(dirPath);+ TSCORE.hideLoadingAnimation();+ console.error("Getting sub directories of : " + dirPath + " failed: " + error.code);+ }+ );+ };++ function getDirectoryMetaInformation(dirPath, readyCallback) {+ console.log("getDirectoryMetaInformation directory: " + dirPath);+ dirPath = dirPath + "/"; // TODO make it platform independent+ dirPath = normalizePath(dirPath);+ var anotatedDirList = [];++ fsRoot.getDirectory(dirPath, {+ create: false,+ exclusive: false+ },+ function(dirEntry) {+ var directoryReader = dirEntry.createReader();+ directoryReader.readEntries(+ function(entries) {+ var i;+ var normalizedPath;+ for (i = 0; i < entries.length; i++) {+ if (entries[i].isFile) {+ entries[i].file(+ function(entry) {+ if (!entry.fullPath) {+ entry.fullPath = resolveFullPath(entry.localURL);+ }+ anotatedDirList.push({+ "name": entry.name,+ "isFile": true,+ "size": entry.size,+ "lmdt": entry.lastModifiedDate,+ "path": entry.fullPath+ });TSCORE.metaFileList = (anotatedDirList);}, // jshint ignore:linefunction(error) { // error get file system@@ -627,139 +650,53 @@ define(function(require, exports, module) {);};- function listDirectoryPromiseOld(path) {++ function getPropertiesPromise(filePath) {return new Promise(function(resolve, reject) {- var anotatedDirList = [];- var fileWorkers = [];- getFileSystemPromise(path).then(function(fileSystem) {- var reader = fileSystem.createReader();- reader.readEntries(- function (entries) {- for (var i = 0; i < entries.length; i++) {- if (entries[i].isDirectory) {- var obj = {- "name": entries[i].name,- "path": entries[i].fullPath,- "isFile": false,- "size": "",- "lmdt": ""- };- anotatedDirList.push(obj);- } else {- var filePromise = Promise.resolve({- then: function(resolve, reject) {- entries[i].file(function(entry) {- resolve({- "name": entry.name,- "isFile": true,- "size": entry.size,- "lmdt": entry.lastModifiedDate,- "path": entry.fullPath- });- }, function(err) {- reject("Error reading entry " + entry.name);- }- );- }- });- fileWorkers.push(filePromise);- }+ filePath = normalizePath(filePath);+ //getFileSystemPromise(dir).then(function(fileSystem) {+ var fileProperties = {};+ fsRoot.getFile(filePath, {+ create: false,+ exclusive: false+ },+ function(entry) {+ if (entry.isFile) {+ entry.file(+ function(file) {+ fileProperties.path = entry.fullPath;+ fileProperties.size = file.size;+ fileProperties.lmdt = file.lastModifiedDate;+ fileProperties.mimetype = file.type;+ resolve(fileProperties);+ },+ function() {+ reject("Error retrieving file properties of " + filePath);+ }+ );+ } else {+ reject("Error getting file properties. " + filePath + " is directory");}- Promise.all(fileWorkers).then(function(values) {- if(values.length > 0) {- anotatedDirList = anotatedDirList.concat(values);- }- resolve(anotatedDirList);- });},- function (err) {- console.log(err);- reject(err);+ function() {+ reject("error getting file");});- }).catch(reject);- });+ });+ //});}- var deleteElement = function(filePath) {-- TSCORE.showLoadingAnimation();- deleteFilePromise(filePath).then(function() {- TSPOSTIO.deleteElement(filePath);- }).catch(function(error) {- TSCORE.hideLoadingAnimation();- console.error(error);- });- };-- var deleteDirectory = function(dirPath) {- TSCORE.showLoadingAnimation();- deleteDirectoryPromise(dirPath).then(function() {- TSPOSTIO.deleteDirectory(dirPath);- }).catch(function(error) {+ function getFileProperties(filePath) {+ getPropertiesPromise(filePath).then(function(fileProperties) {+ TSPOSTIO.getFileProperties(fileProperties);+ }).catch(function(error){TSCORE.hideLoadingAnimation();- TSPOSTIO.deleteDirectoryFailed(dirPath);console.error(error);});};- function deleteFilePromise(filePath) {- console.log("Deleting: " + filePath);- return new Promise(function(resolve, reject) {- var path = normalizePath(filePath);- fsRoot.getFile(path, {- create: false,- exclusive: false- },- function(entry) {- entry.remove(- function() {- console.log("file deleted: " + path);- resolve(filePath);- },- function() {- reject("error deleting: " + filePath);- }- );- },- function() {- reject("error getting file");- }- );- });- }-- function deleteDirectoryPromise(dirPath) {- console.log("Deleting directory: " + dirPath);- return new Promise(function(resolve,reject){-- var path = normalizePath(dirPath);-- fsRoot.getDirectory(path, {- create: false,- exclusive: false- },- function(entry) {- entry.remove(- function() {- console.log("file deleted: " + path);- resolve(dirPath);- },- function() {- //TSCORE.hideLoadingAnimation();- //TSPOSTIO.deleteDirectoryFailed(path);- reject("error deleting dir: " + dirPath);- }- );- },- function() {- reject("error getting directory");- }- );- });- }- var loadTextFile = function(filePath, isPreview) {+ function loadTextFile(filePath, isPreview) {console.log("Loading file: " + filePath);TSCORE.showLoadingAnimation();getFileContentPromise(filePath, "text").then(function(text) {@@ -773,41 +710,56 @@ define(function(require, exports, module) {});};- var saveTextFile = function(filePath, content, overWrite, silentMode) {- console.log("Saving file: " + filePath);- TSCORE.showLoadingAnimation();-- // Handling the UTF8 support for text files- var UTF8_BOM = "\ufeff";-- if (content.indexOf(UTF8_BOM) === 0) {- console.log("Content beging with a UTF8 bom");- } else {- content = UTF8_BOM + content;- }+ function getFileContent(fullPath, result, error) {+ getFile(fullPath, function(file) {+ var reader = new FileReader();+ reader.onerror = function() {+ error(reader.error);+ };+ reader.onload = function() {+ result(reader.result);+ };+ reader.readAsArrayBuffer(file);+ }, error);+ }- saveFilePromise(filePath, content, overWrite).then(function(isFileNew) {- if (!silentMode) {- TSPOSTIO.saveTextFile(filePath, isFileNew);+ function getFilePromise(filePath, resolvePath) {+ return new Promise(function(resolve, reject) {+ if (resolvePath) {+ getFileSystemPromise(resolvePath).then(function(resfs) {+ resfs.getFile(filePath, {create: false},+ function(fileEntry) {+ fileEntry.file(resolve, reject);+ },+ reject+ );+ }).catch(reject);+ } else {+ getFile(filePath, resolve, reject);}- }).catch(function(error) {- TSCORE.hideLoadingAnimation();- console.log(error);});- };+ }- var saveBinaryFile = function(filePath, content, overWrite, silentMode) {- TSCORE.showLoadingAnimation();- var dataView = new Int8Array(content);- saveFilePromise(filePath, dataView.buffer, overWrite).then(function(isFileNew) {- if (!silentMode) {- TSPOSTIO.saveBinaryFile(filePath);- }- }).catch(function(error) {- TSCORE.hideLoadingAnimation();- console.log(error);+ function getFileContentPromise(filePath, type, resolvePath) {++ return new Promise(function(resolve, reject) {+ getFilePromise(filePath, resolvePath).then(function(file) {+ var reader = new FileReader();+ reader.onerror = function() {+ reject(reader.error);+ };+ reader.onload = function() {+ resolve(reader.result);+ };+ if (type === "text") {+ reader.readAsText(file);+ } else {+ reader.readAsArrayBuffer(file);+ }+ }, reject);});- };+ }+function saveFilePromise(filePath, content, overWrite) {console.log("Saving file: " + filePath);@@ -857,32 +809,43 @@ define(function(require, exports, module) {});}- var createDirectory = function(dirPath, silentMode) {- createDirectoryPromise(dirPath).then(function() {+ function saveTextFile(filePath, content, overWrite, silentMode) {+ console.log("Saving file: " + filePath);+ TSCORE.showLoadingAnimation();++ // Handling the UTF8 support for text files+ var UTF8_BOM = "\ufeff";++ if (content.indexOf(UTF8_BOM) === 0) {+ console.log("Content beging with a UTF8 bom");+ } else {+ content = UTF8_BOM + content;+ }++ saveFilePromise(filePath, content, overWrite).then(function(isFileNew) {if (!silentMode) {- TSPOSTIO.createDirectory(dirPath);+ TSPOSTIO.saveTextFile(filePath, isFileNew);}}).catch(function(error) {- TSCORE.hideLoadingAnimation();- console.error(error);+ TSCORE.hideLoadingAnimation();+ console.log(error);});};- var createMetaFolder = function(dirPath) {- if (dirPath.lastIndexOf(TSCORE.metaFolder) >= dirPath.length - TSCORE.metaFolder.length) {- console.log("Can not create meta folder in a meta folder");- return;- }-- var metaDirPath = dirPath + TSCORE.dirSeparator + TSCORE.metaFolder;- createDirectoryPromise(metaDirPath).then(function(){- console.log("Metafolder created: " + metaDirPath);+ function saveBinaryFile(filePath, content, overWrite, silentMode) {+ TSCORE.showLoadingAnimation();+ var dataView = new Int8Array(content);+ saveFilePromise(filePath, dataView.buffer, overWrite).then(function(isFileNew) {+ if (!silentMode) {+ TSPOSTIO.saveBinaryFile(filePath);+ }}).catch(function(error) {TSCORE.hideLoadingAnimation();- console.error(error);+ console.log(error);});};+function createDirectoryPromise(dirPath) {console.log("Creating directory: " + dirPath);return new Promise(function(resolve, reject) {@@ -901,16 +864,33 @@ define(function(require, exports, module) {});}- var copyFile = function(filePath, newFilePath) {- copyFilePromise(filePath, newFilePath).then(function(newFilePath) {- TSPOSTIO.copyFile(filePath, newFilePath);+ function createDirectory(dirPath, silentMode) {+ createDirectoryPromise(dirPath).then(function() {+ if (!silentMode) {+ TSPOSTIO.createDirectory(dirPath);+ }}).catch(function(error) {TSCORE.hideLoadingAnimation();- console.log(error);+ console.error(error);});+ };+ function createMetaFolder(dirPath) {+ if (dirPath.lastIndexOf(TSCORE.metaFolder) >= dirPath.length - TSCORE.metaFolder.length) {+ console.log("Can not create meta folder in a meta folder");+ return;+ }++ var metaDirPath = dirPath + TSCORE.dirSeparator + TSCORE.metaFolder;+ createDirectoryPromise(metaDirPath).then(function(){+ console.log("Metafolder created: " + metaDirPath);+ }).catch(function(error) {+ TSCORE.hideLoadingAnimation();+ console.error(error);+ });};+function copyFilePromise(filePath, newFilePath) {return new Promise(function(resolve, reject){filePath = normalizePath(filePath);@@ -951,18 +931,18 @@ define(function(require, exports, module) {});}- var renameFile = function(filePath, newFilePath) {-- renameFilePromise(filePath, newFilePath).then(function(){- TSPOSTIO.renameFile(filePath, newFilePath);- }).catch(function(error){+ function copyFile(filePath, newFilePath) {+ copyFilePromise(filePath, newFilePath).then(function(newFilePath) {+ TSPOSTIO.copyFile(filePath, newFilePath);+ }).catch(function(error) {TSCORE.hideLoadingAnimation();- console.error(error);+ console.log(error);});+};- function renameFilePromise(filePath, newFilePath) {+ function renameFilePromise(filePath, newFilePath) {return new Promise(function(resolve, reject) {filePath = normalizePath(filePath);@@ -1005,18 +985,17 @@ define(function(require, exports, module) {});}- var renameDirectory = function(dirPath, newDirName) {-- renameDirectoryPromise(dirPath, newDirName).then(function(newDirPath) {- TSPOSTIO.renameDirectory(dirPath, newDirPath);- }).catch(function(error) {+ function renameFile(filePath, newFilePath) {+ renameFilePromise(filePath, newFilePath).then(function(){+ TSPOSTIO.renameFile(filePath, newFilePath);+ }).catch(function(error){TSCORE.hideLoadingAnimation();console.error(error);});};- function renameDirectoryPromise(dirPath, newDirName) {+ function renameDirectoryPromise(dirPath, newDirName) {return new Promise(function(resolve, reject) {var newDirPath = TSCORE.TagUtils.extractParentDirectoryPath(dirPath) + TSCORE.dirSeparator + newDirName;@@ -1061,202 +1040,169 @@ define(function(require, exports, module) {});}- var selectDirectory = function() {- console.log("Open select directory dialog.");- TSCORE.showDirectoryBrowserDialog(fsRoot.fullPath);+ function renameDirectory(dirPath, newDirName) {+ renameDirectoryPromise(dirPath, newDirName).then(function(newDirPath) {+ TSPOSTIO.renameDirectory(dirPath, newDirPath);+ }).catch(function(error) {+ TSCORE.hideLoadingAnimation();+ console.error(error);+ });};- var selectFile = function() {- console.log("Operation selectFile not supported.");- };- var checkAccessFileURLAllowed = function() {- console.log("checkAccessFileURLAllowed function not relevant for in Cordova...");- };+ function deleteFilePromise(filePath) {+ return new Promise(function(resolve, reject) {+ var path = normalizePath(filePath);+ fsRoot.getFile(path, {+ create: false,+ exclusive: false+ },+ function(entry) {+ entry.remove(+ function() {+ console.log("file deleted: " + path);+ resolve(filePath);+ },+ function() {+ reject("error deleting: " + filePath);+ }+ );+ },+ function() {+ reject("error getting file");+ }+ );+ });+ }- var openDirectory = function(dirPath) {- TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));+ function deleteElement(filePath) {+ deleteFilePromise(filePath).then(function() {+ TSPOSTIO.deleteElement(filePath);+ }).catch(function(error) {+ TSCORE.hideLoadingAnimation();+ console.error(error);+ });};- var openFile = function(filePath) {- console.log("Opening natively: " + filePath);- window.plugins.fileOpener.open(filePath);- };- var sendFile = function(filePath) {- console.log("Sending file: " + filePath);- window.plugins.fileOpener.send(filePath);- };+ function deleteDirectoryPromise(dirPath) {+ console.log("Deleting directory: " + dirPath);+ return new Promise(function(resolve,reject){- var getFileProperties = function(filePath) {- getFilePropertiesPromise(filePath).then(function(fileProperties) {- TSPOSTIO.getFileProperties(fileProperties);- }).catch(function(error){+ var path = normalizePath(dirPath);++ fsRoot.getDirectory(path, {+ create: false,+ exclusive: false+ },+ function(entry) {+ entry.remove(+ function() {+ console.log("file deleted: " + path);+ resolve(dirPath);+ },+ function() {+ //TSCORE.hideLoadingAnimation();+ //TSPOSTIO.deleteDirectoryFailed(path);+ reject("error deleting dir: " + dirPath);+ }+ );+ },+ function() {+ reject("error getting directory");+ }+ );+ });+ }++ function deleteDirectory(dirPath) {+ TSCORE.showLoadingAnimation();+ deleteDirectoryPromise(dirPath).then(function() {+ TSPOSTIO.deleteDirectory(dirPath);+ }).catch(function(error) {TSCORE.hideLoadingAnimation();+ TSPOSTIO.deleteDirectoryFailed(dirPath);console.error(error);});};- function getFilePropertiesPromise(filePath) {- return new Promise(function(resolve, reject) {- filePath = normalizePath(filePath);- //getFileSystemPromise(dir).then(function(fileSystem) {- var fileProperties = {};- fsRoot.getFile(filePath, {- create: false,- exclusive: false- },- function(entry) {- if (entry.isFile) {- entry.file(- function(file) {- fileProperties.path = entry.fullPath;- fileProperties.size = file.size;- fileProperties.lmdt = file.lastModifiedDate;- fileProperties.mimetype = file.type;- resolve(fileProperties);- },- function() {- reject("Error retrieving file properties of " + filePath);- }- );- } else {- reject("Error getting file properties. " + filePath + " is directory");- }- },- function() {- reject("error getting file");- }- );- });- //});- }- // Bring the TagSpaces window on top of the windows- var focusWindow = function() {- console.log("Focusing window is not implemented in cordova.");+ function selectDirectory() {+ console.log("Open select directory dialog.");+ TSCORE.showDirectoryBrowserDialog(fsRoot.fullPath);};- function walkDirectory(path, options, fileCallback, dirCallback) {- return listDirectoryPromise(path).then(function(entries) {- return Promise.all(entries.map(function(entry) {- if(!options) {- options = {};- options.recursive = false;- }+ function selectFile() {+ //+ console.log("Operation selectFile not supported.");+ };- if (entry.isFile) {- if(fileCallback) {- return fileCallback(entry);- } else {- return entry;- }- } else {- if(dirCallback) {- return dirCallback(entry);- }- if(options.recursive) {- return walkDirectory(entry.path, options, fileCallback, dirCallback);- } else {- return entry;- }- }- }), function(err) {- console.error("Error list dir prom " + err);- return null;- });- });- }- function listDirectoryPromise(path){- return new Promise(function(resolve, reject) {- var anotatedDirList = [];- var fileWorkers = [];- getFileSystemPromise(path).then(function(fileSystem) {- var reader = fileSystem.createReader();- reader.readEntries(- function (entries) {- for (var i = 0; i < entries.length; i++) {- if (entries[i].isDirectory) {- anotatedDirList.push({- "name": entries[i].name,- "path": entries[i].fullPath,- "isFile": false,- "size": "",- "lmdt": ""- });- } else {- var filePromise = Promise.resolve({- then: function(resolve, reject) {- if(entries[i] && entries[i].isFile) {- entries[i].file(function(entry) {- resolve({- "name": entry.name,- "isFile": true,- "size": entry.size,- "lmdt": entry.lastModifiedDate,- "path": entry.fullPath- });- }, function(err) {- console.log("Error reading entry " + entry.name);- }- );- }- }- });- fileWorkers.push(filePromise);- }- }- Promise.all(fileWorkers).then(function(values) {- if(values.length > 0) {- anotatedDirList = anotatedDirList.concat(values);- }- resolve(anotatedDirList);- });- },- function (err) {- reject(err);- }- );- }, function (err) {- reject(err);- }- );- });- }+ function openDirectory(dirPath) {+ //+ TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));+ };- exports.focusWindow = focusWindow;- exports.createDirectory = createDirectory;- exports.createMetaFolder = createMetaFolder;- exports.copyFile = copyFile;- exports.renameFile = renameFile;- exports.renameDirectory = renameDirectory;- exports.loadTextFile = loadTextFile;- exports.saveTextFile = saveTextFile;- exports.saveBinaryFile = saveBinaryFile;- exports.listDirectory = listDirectory;- exports.listSubDirectories = listSubDirectories;- exports.deleteElement = deleteElement;- exports.deleteDirectory = deleteDirectory;- exports.createDirectoryIndex = createDirectoryIndex;- exports.createDirectoryTree = createDirectoryTree;- exports.selectDirectory = selectDirectory;- exports.openDirectory = openDirectory;- exports.openFile = openFile;- exports.sendFile = sendFile;- exports.selectFile = selectFile;- exports.checkAccessFileURLAllowed = checkAccessFileURLAllowed;- exports.checkNewVersion = checkNewVersion;- exports.getFileProperties = getFileProperties;- exports.handleStartParameters = handleStartParameters;+ function openFile(filePath) {+ console.log("Opening natively: " + filePath);+ window.plugins.fileOpener.open(filePath);+ };++ // Platform specific callsexports.saveSettings = saveSettings;exports.loadSettings = loadSettings;exports.saveSettingsTags = saveSettingsTags;exports.loadSettingsTags = loadSettingsTags;- exports.getFile = getFile;- exports.getFileContent = getFileContent;+ exports.sendFile = sendFile;++ // Platform API+ exports.checkNewVersion = checkNewVersion;+ exports.focusWindow = focusWindow;+ exports.handleStartParameters = handleStartParameters;++ exports.createDirectoryIndex = createDirectoryIndex;+ exports.createDirectoryTree = createDirectoryTree;++ exports.listDirectoryPromise = listDirectoryPromise;+ exports.listDirectory = listDirectory; /** @deprecated */+ exports.listSubDirectories = listSubDirectories; /** @deprecated */exports.getDirectoryMetaInformation = getDirectoryMetaInformation;++ exports.getPropertiesPromise = getPropertiesPromise;+ exports.getFileProperties = getFileProperties; /** @deprecated */++ exports.loadTextFilePromise = loadTextFilePromise;+ exports.loadTextFile = loadTextFile;+ exports.getFile = getFile; // export ??+ exports.getFileContent = getFileContent;exports.getFileContentPromise = getFileContentPromise;- exports.listDirectoryPromise = listDirectoryPromise;- exports.walkDirectory = walkDirectory;++ exports.saveFilePromise = saveFilePromise;+ exports.saveTextFile = saveTextFile; /** @deprecated */+ exports.saveBinaryFile = saveBinaryFile; /** @deprecated */++ exports.createDirectoryPromise = createDirectoryPromise;+ exports.createDirectory = createDirectory; /** @deprecated */+ exports.createMetaFolder = createMetaFolder; /** @deprecated */++ exports.copyFilePromise = copyFilePromise;+ exports.copyFile = copyFile; /** @deprecated */++ exports.renameFilePromise = renameFilePromise;+ exports.renameFile = renameFile; /** @deprecated */++ exports.renameDirectoryPromise = renameDirectoryPromise;+ exports.renameDirectory = renameDirectory; /** @deprecated */++ exports.deleteFilePromise = deleteFilePromise;+ exports.deleteElement = deleteElement; /** @deprecated */++ exports.deleteDirectoryPromise = deleteDirectoryPromise;+ exports.deleteDirectory = deleteDirectory; /** @deprecated */++ exports.selectDirectory = selectDirectory;+ exports.selectFile = selectFile;++ exports.openDirectory = openDirectory;+ exports.openFile = openFile;});diff --git a/data/mozilla/mozilla.api.js b/data/mozilla/mozilla.api.jsindex d0e2cf023..98ec4c4aa 100644--- a/data/mozilla/mozilla.api.js+++ b/data/mozilla/mozilla.api.js@@ -156,7 +156,28 @@ define(function(require, exports, module) {}}, false);- var saveSettings = function(content) {+ function base64toArrayBuffer(str) {+ var bstr = atob(str);+ var len = bstr.length;+ var bytes = new Uint8Array(len);+ for (var i = 0; i < len; i++) {+ bytes[i] = bstr.charCodeAt(i);+ }+ return bytes.buffer;+ }++ function ab2str(buf) {+ //TODO add support for larger files+ // http://updates.html5rocks.com/2014/08/Easier-ArrayBuffer---String-conversion-with-the-Encoding-API+ return String.fromCharCode.apply(null, new Uint8Array(buf));+ }++ function focusWindow() {+ // Bring the TagSpaces window on top of the windows+ window.focus();+ };++ function saveSettings(content) {console.log("Saving setting...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {@@ -168,7 +189,7 @@ define(function(require, exports, module) {document.documentElement.dispatchEvent(event);};- var loadSettings = function() {+ function loadSettings() {console.log("Loading setting from firefox preferences...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {@@ -179,20 +200,60 @@ define(function(require, exports, module) {document.documentElement.dispatchEvent(event);};- var createDirectory = function(dirPath, silentMode) {- console.log("Directory " + dirPath + " created.");+ function checkNewVersion() {+ console.log("Checking for new version...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "createDirectory",- "path": dirPath,- "silent" : silentMode+ "command": "checkNewVersion"}});document.documentElement.dispatchEvent(event);};- var loadTextFile = function(filePath) {++ function listDirectoryPromise(dirPath) {+ return new Promise(function(resolve, reject) {++ console.log("Listing directory: " + dirPath);+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent("addon-message", true, true, {+ "detail": {+ "command": "listDirectory",+ "path": dirPath+ }+ });+ document.documentElement.dispatchEvent(event);++ function eventListener(event) {+ var message = event.detail;+ if (message.command === "listDirectory") {+ if (message.success) {+ resolve(message.content);+ } else {+ reject("listDirectory" + dirPath + " failed");+ }+ document.documentElement.removeEventListener("tsMessage", eventListener);+ }+ }+ document.documentElement.addEventListener("tsMessage", eventListener);+ });+ }++ function getDirectoryMetaInformation(dirPath, readyCallback) {+ console.log("getDirectoryMetaInformation: " + dirPath);+ listDirectoryPromise(dirPath).then( function(success) {+ readyCallback(success);+ },+ function(error) {+ console.warn("Error: " + error);+ TSPOSTIO.errorOpeningPath();+ }+ );+ };+++ function loadTextFile(filePath) {console.log("Loading file: " + filePath);getFileContentPromise(filePath).then(function(success) {@@ -237,102 +298,84 @@ define(function(require, exports, module) {});}- function listDirectoryPromise(dirPath) {-- return new Promise(function(resolve, reject) {-- console.log("Listing directory: " + dirPath);- var event = document.createEvent('CustomEvent');- event.initCustomEvent("addon-message", true, true, {- "detail": {- "command": "listDirectory",- "path": dirPath- }- });- document.documentElement.dispatchEvent(event);-- function eventListener(event) {- var message = event.detail;- if (message.command === "listDirectory") {- if (message.success) {- resolve(message.content);- } else {- reject("listDirectory" + dirPath + " failed");- }- document.documentElement.removeEventListener("tsMessage", eventListener);- }- }- document.documentElement.addEventListener("tsMessage", eventListener);- });- }- var copyFile = function(filePath, newFilePath) {- console.log("Copy " + filePath + " to " + newFilePath);+ function saveTextFile(filePath, content, overWrite, silentMode) {+ console.log("Saving file: " + filePath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "copy",+ "command": "saveTextFile","path": filePath,- "newPath": newFilePath+ "content": content,+ "overwrite": overWrite,+ "silent": silentMode}});document.documentElement.dispatchEvent(event);};- var renameFile = function(filePath, newFilePath) {- console.log("Renaming " + filePath + " to " + newFilePath);+ function saveBinaryFile(filePath, content, overWrite, silentMode) {+ console.log("Saving binary file post: " + filePath); //+" - "+content);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "rename",+ "command": "saveBinaryFile","path": filePath,- "newPath": newFilePath+ "content": ab2str(content),+ "overwrite": overWrite,+ "silent": silentMode}});document.documentElement.dispatchEvent(event);};- var renameDirectory = function(filePath, newFilePath) {- TSCORE.showAlertDialog($.i18n.t("ns.common:functionalityNotImplemented"));++ function createDirectory(dirPath, silentMode) {+ console.log("Directory " + dirPath + " created.");+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent("addon-message", true, true, {+ "detail": {+ "command": "createDirectory",+ "path": dirPath,+ "silent" : silentMode+ }+ });+ document.documentElement.dispatchEvent(event);};- var saveTextFile = function(filePath, content, overWrite, silentMode) {- console.log("Saving file: " + filePath);+ function copyFile(filePath, newFilePath) {+ console.log("Copy " + filePath + " to " + newFilePath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "saveTextFile",+ "command": "copy","path": filePath,- "content": content,- "overwrite": overWrite,- "silent": silentMode+ "newPath": newFilePath}});document.documentElement.dispatchEvent(event);};- function ab2str(buf) {- //TODO add support for larger files- // http://updates.html5rocks.com/2014/08/Easier-ArrayBuffer---String-conversion-with-the-Encoding-API- return String.fromCharCode.apply(null, new Uint8Array(buf));- }-- var saveBinaryFile = function(filePath, content, overWrite, silentMode) {- console.log("Saving binary file post: " + filePath); //+" - "+content);+ function renameFile(filePath, newFilePath) {+ console.log("Renaming " + filePath + " to " + newFilePath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "saveBinaryFile",+ "command": "rename","path": filePath,- "content": ab2str(content),- "overwrite": overWrite,- "silent": silentMode+ "newPath": newFilePath}});document.documentElement.dispatchEvent(event);};- var listDirectory = function(dirPath) {+ function renameDirectory(filePath, newFilePath) {+ //+ TSCORE.showAlertDialog($.i18n.t("ns.common:functionalityNotImplemented"));+ };+++ function listDirectory(dirPath) {console.log("Listing directory: " + dirPath);listDirectoryPromise(dirPath).then( function(success) {TSPOSTIO.listDirectory(success);@@ -344,7 +387,7 @@ define(function(require, exports, module) {);};- var deleteElement = function(path) {+ function deleteElement(path) {console.log("Deleting: " + path);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {@@ -356,165 +399,148 @@ define(function(require, exports, module) {document.documentElement.dispatchEvent(event);};- var deleteDirectory = function(dirPath) {+ function deleteDirectory(dirPath) {+ //TSCORE.showAlertDialog($.i18n.t("ns.common:functionalityNotImplemented"));};- var checkAccessFileURLAllowed = function() {- console.log("checkAccessFileURLAllowed function not relevant for node..");- };- var selectDirectory = function() {- console.log("Selecting directory...");+ function createDirectoryIndex(dirPath) {+ console.log("Creating directory index for: " + dirPath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "selectDirectory"+ "command": "createDirectoryIndex",+ "path": dirPath}});document.documentElement.dispatchEvent(event);};- var selectFile = function() {- console.log("Selecting file...");+ function createDirectoryTree(dirPath) {+ console.log("Creating directory tree for: " + dirPath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "selectFile"+ "command": "createDirectoryTree",+ "path": dirPath}});document.documentElement.dispatchEvent(event);};- var openDirectory = function(dirPath) {- console.log("Opening directory: " + dirPath);+ function getFileProperties(filePath) {+ console.log("Getting file properties...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "openDirectory",- "path": dirPath+ "command": "getFileProperties",+ "path": filePath}});document.documentElement.dispatchEvent(event);};- var createDirectoryIndex = function(dirPath) {- console.log("Creating directory index for: " + dirPath);++ function getFileContent(filePath, result, error) {+ args = [result, error];var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "createDirectoryIndex",- "path": dirPath+ "command": "getFileContent",+ "path": filePath}});document.documentElement.dispatchEvent(event);};- var createDirectoryTree = function(dirPath) {- console.log("Creating directory tree for: " + dirPath);++ function selectDirectory() {+ console.log("Selecting directory...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "createDirectoryTree",- "path": dirPath+ "command": "selectDirectory"}});document.documentElement.dispatchEvent(event);};- var checkNewVersion = function() {- console.log("Checking for new version...");+ function selectFile() {+ console.log("Selecting file...");var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "checkNewVersion"+ "command": "selectFile"}});document.documentElement.dispatchEvent(event);};- var getFileProperties = function(filePath) {- console.log("Getting file properties...");+ function openDirectory(dirPath) {+ console.log("Opening directory: " + dirPath);var event = document.createEvent('CustomEvent');event.initCustomEvent("addon-message", true, true, {"detail": {- "command": "getFileProperties",- "path": filePath+ "command": "openDirectory",+ "path": dirPath}});document.documentElement.dispatchEvent(event);};- var openFile = function(filePath) {+ function openFile(filePath) {// TODO implement openFile for firefoxconsole.log("Open file functionality not implemented in Firefox yet!");TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openFileNativelyAlert"));};- // Bring the TagSpaces window on top of the windows- var focusWindow = function() {- window.focus();- };+ // mozilla specific+ exports.saveSettings = saveSettings;+ exports.loadSettings = loadSettings;- var getFileContent = function(filePath, result, error) {- args = [result, error];- var event = document.createEvent('CustomEvent');- event.initCustomEvent("addon-message", true, true, {- "detail": {- "command": "getFileContent",- "path": filePath- }- });- document.documentElement.dispatchEvent(event);- };+ // Platform API+ exports.focusWindow = focusWindow;+ exports.checkNewVersion = checkNewVersion;- function base64toArrayBuffer(str) {- var bstr = atob(str);- var len = bstr.length;- var bytes = new Uint8Array(len);- for (var i = 0; i < len; i++) {- bytes[i] = bstr.charCodeAt(i);- }- return bytes.buffer;- }+ exports.createDirectoryIndex = createDirectoryIndex;+ exports.createDirectoryTree = createDirectoryTree;- var getDirectoryMetaInformation = function(dirPath, readyCallback) {- console.log("getDirectoryMetaInformation: " + dirPath);- listDirectoryPromise(dirPath).then( function(success) {- readyCallback(success);- },- function(error) {- console.warn("Error: " + error);- TSPOSTIO.errorOpeningPath();- }- );- };+ exports.listDirectoryPromise = listDirectoryPromise;+ exports.listDirectory = listDirectory;+ exports.getDirectoryMetaInformation = getDirectoryMetaInformation;++ exports.getFileProperties = getFileProperties;- exports.focusWindow = focusWindow;- exports.createDirectory = createDirectory;- exports.copyFile = copyFile;- exports.renameFile = renameFile;- exports.renameDirectory = renameDirectory;exports.loadTextFile = loadTextFile;exports.getFileContentPromise = getFileContentPromise;- exports.saveTextFile = saveTextFile;- exports.saveBinaryFile = saveBinaryFile;- exports.listDirectory = listDirectory;- exports.deleteElement = deleteElement;- exports.deleteDirectory = deleteDirectory;- exports.createDirectoryIndex = createDirectoryIndex;- exports.createDirectoryTree = createDirectoryTree;+ exports.getFileContent = getFileContent;++ //exports.saveFilePromise = saveFilePromise;+ exports.saveTextFile = saveTextFile; /** @deprecated */+ exports.saveBinaryFile = saveBinaryFile; /** @deprecated */++ //exports.createDirectoryPromise = createDirectoryPromise;+ exports.createDirectory = createDirectory; /** @deprecated */++ //exports.copyFilePromise = copyFilePromise;+ exports.copyFile = copyFile; /** @deprecated */++ //exports.renameFilePromise = renameFilePromise;+ exports.renameFile = renameFile; /** @deprecated */++ //exports.renameDirectoryPromise = renameDirectoryPromise;+ exports.renameDirectory = renameDirectory; /** @deprecated */++ //exports.deleteFilePromise = deleteFilePromise;+ exports.deleteElement = deleteElement; /** @deprecated */++ //exports.deleteDirectoryPromise = deleteDirectoryPromise;+ exports.deleteDirectory = deleteDirectory; /** @deprecated */+exports.selectDirectory = selectDirectory;+ exports.selectFile = selectFile;+exports.openDirectory = openDirectory;exports.openFile = openFile;- exports.selectFile = selectFile;- exports.checkAccessFileURLAllowed = checkAccessFileURLAllowed;- exports.checkNewVersion = checkNewVersion;- exports.getFileProperties = getFileProperties;- exports.getFileContent = getFileContent;- exports.getDirectoryMetaInformation = getDirectoryMetaInformation;- exports.listDirectoryPromise = listDirectoryPromise;- // mozilla specific- exports.saveSettings = saveSettings;- exports.loadSettings = loadSettings;});diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.jsindex ce7a05ac8..7f1cb05ff 100644--- a/data/node-webkit/node-webkit.api.js+++ b/data/node-webkit/node-webkit.api.js@@ -824,12 +824,12 @@ define(function(require, exports, module) {};// Platform specific calls- exports.handleStartParameters = handleStartParameters;exports.initMainMenu = initMainMenu;- exports.focusWindow = focusWindow;exports.showMainWindow = showMainWindow;- // API+ // Platform API+ exports.handleStartParameters = handleStartParameters;+ exports.focusWindow = focusWindow;exports.checkNewVersion = checkNewVersion;exports.createDirectoryIndex = createDirectoryIndex;@@ -848,14 +848,14 @@ define(function(require, exports, module) {exports.getFileContent = getFileContent; /** @deprecated */exports.getFileContentPromise = getFileContentPromise;- exports.createDirectoryPromise = createDirectoryPromise;- exports.createDirectory = createDirectory; /** @deprecated */- exports.createMetaFolder = createMetaFolder; /** @deprecated */-exports.saveFilePromise = saveFilePromise;exports.saveTextFile = saveTextFile; /** @deprecated */exports.saveBinaryFile = saveBinaryFile; /** @deprecated */+ exports.createDirectoryPromise = createDirectoryPromise;+ exports.createDirectory = createDirectory; /** @deprecated */+ exports.createMetaFolder = createMetaFolder; /** @deprecated */+exports.copyFilePromise = copyFilePromise;exports.copyFile = copyFile; /** @deprecated */diff --git a/data/web/web.api.js b/data/web/web.api.jsindex db427577c..5911c18bc 100644--- a/data/web/web.api.js+++ b/data/web/web.api.js@@ -540,6 +540,7 @@ define(function(require, exports, module) {TSCORE.showAlertDialog("openFile not relevant for webdav");};+ // Platform APIexports.focusWindow = focusWindow;exports.checkNewVersion = checkNewVersion;