TagSpaces is an offline, open source, document manager with tagging support
ioapi for chrome finalized
uggrock22e04a35dde2
diff --git a/build.number b/build.numberindex efac99741..83d34ab78 100644--- a/build.number+++ b/build.number@@ -1,4 +1,4 @@#Build Number for ANT. Do not edit!-#Tue Jul 09 17:10:58 CEST 2013-build.number=1388+#Fri Jul 12 14:03:59 CEST 2013+build.number=13963=diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.jsindex 94351e310..c4e3d0884 100644--- a/data/js/ioapi.chrome.js+++ b/data/js/ioapi.chrome.js@@ -10,17 +10,8 @@ define(function(require, exports, module) {var TSCORE = require("tscore");/**-Old:- Interface of npapi-file-io- getTextFile(filename : string) : string- getBinaryFile(filename : string) : array<byte>-- bool getFile(const char *filename, char *&value, size_t &len, const bool issBinary);- bool saveText(const char *filename, const char *value, size_t len);- saveTextFile- bool saveBinaryFile(const char *filename, const char *bytes, const size_t len);+API of npapifileioforchrome:-New:bool createDirectory(std::string path);bool saveBlobToFile(std::string path, FB::JSObjectPtr dataArray);FB::VariantList getDirEntries(std::string path);@@ -35,13 +26,11 @@ New:void stopWatching(std::string key);std::string getChromeDataDir(std::string version);-Missing:- renameFile- openDirectory- selectDirectory-- fileSize buggy- lastModified datetime+Still Missing:+ renameFile real one+ openDirectory+ fileSize buggy in a loop+ lastModified datetime completely missing*/var plugin = document.createElement("embed");@@ -216,7 +205,7 @@ Missing:exports.deleteElement = function(path) {console.log("Deleting: "+path);try {- nativeIO.removeRecursively(path)+ nativeIO.removeRecursively(path);} catch(ex) {console.error("Deleting file failed "+ex);}@@ -238,22 +227,23 @@ Missing:}exports.saveTextFile = function(filePath,content) {- // TODO implement saveTextFile use saveBlobToFileconsole.log("Saving file: "+filePath);-// console.log("Saving file functionality not implemented on chrome yet!");-// TSCORE.showAlertDialog("Saving file functionality not implemented on chrome yet!")--/* var reader = new FileReader();- reader.onloadend = function(e){- var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);- //assumes one append call before writing- nativeIO.saveBlobToFile(filePath, data);- }- reader.readAsArrayBuffer(blob);*/+ var byteArray = [];+ for (var i = 0; i < content.length; ++i)+ {+ byteArray.push(content.charCodeAt(i));+ }+ var blobInt8 = new Int8Array(byteArray);+ var blob = new Blob([blobInt8]);+ var reader = new FileReader();+ reader.onloadend = function(e){+ var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);+ nativeIO.saveBlobToFile(filePath, data);+ }+ reader.readAsArrayBuffer(blob);}exports.createDirectory = function(dirPath) {- // TODO implement create directoryconsole.log("Creating directory: "+dirPath);try {nativeIO.createDirectory(dirPath);@@ -263,34 +253,60 @@ Missing:}exports.renameFile = function(filePath, newFilePath) {- // TODO implement renameFile+ // TODO use a more efficient rename functionality+ // currently the file is copied to the new location and than+ // deleted from the old locationconsole.log("Renaming file: "+filePath+" to "+newFilePath);- console.log("Renaming file functionality not implemented on chrome yet!");- TSCORE.showAlertDialog("Renaming file functionality not implemented on chrome yet!")+ if(nativeIO.fileExists(filePath)) {+ var blob;+ var size = nativeIO.getFileSize(filePath);+ if (size){+ var byteArray = nativeIO.contentsAtPath(filePath);+ blob = new Int8Array(byteArray);+ } else {+ blob = new Int8Array(0);+ }+ var b = new Blob([blob]);+ b.size = size;+ var reader = new FileReader();+ reader.onloadend = function(e){+ var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);+ nativeIO.saveBlobToFile(newFilePath, data);+ if(nativeIO.fileExists(newFilePath)) {+ nativeIO.removeRecursively(filePath);+ }+ TSCORE.PerspectiveManager.refreshFileListContainer();+ }+ reader.readAsArrayBuffer(b);+ } else {+ console.error("File does not exists...");+ }+}exports.selectDirectory = function() {- // TODO implement selectDirectory- console.log("Select directory functionality not implemented on chrome yet!");- // TSCORE.showAlertDialog("Not implemented yet");- /* nativeIO.launchFolderSelect(function(dirPath){+ console.log("Select directory!");+ nativeIO.launchFolderSelect(function(dirPath){if (dirPath && dirPath.length){- $("#favoriteLocation").val(dirPath);+ $("#folderLocation").val(dirPath);}- }); */+ });}+ exports.selectFile = function() {+ console.log("Select file!");+ nativeIO.launchFileSelect(function(filePath){+ if (filePath && filePath.length){+ //$("#folderLocation").val(dirPath);+ }+ });+ }+exports.openDirectory = function(dirPath) {// TODO implement openDirectoryconsole.log("Open directory functionality not implemented on chrome yet!");TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")}-- exports.selectFile = function() {- // TODO implement selectFile- console.log("Select file functionality not implemented on chrome yet!");- TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")- }exports.openExtensionsDirectory = function() {// TODO implement openExtensionsDirectorydiff --git a/data/manifest.json b/data/manifest.jsonindex 8e431db80..f140b02f7 100644--- a/data/manifest.json+++ b/data/manifest.json@@ -1,6 +1,6 @@{"name": "TagSpaces",- "version": "1.4.1386",+ "version": "1.4.1394","manifest_version": 2,"description": "TagSpaces Explorer","icons": {diff --git a/package.json b/package.jsonindex 69b4ba1ac..047f03e23 100644--- a/package.json+++ b/package.json@@ -2,7 +2,7 @@"name": "tagspaces","license": "AGPL 3.0","author": "Ugg Rock",- "version": "1.4.1386",+ "version": "1.4.1394","fullName": "TagSpaces","id": "jid1-FBaMKxTifTSahQ","description": "TagSpaces is a firefox addon, which allows you to browse your local file system and add tags to your files.",diff --git a/update.rdf b/update.rdfindex e48e55c31..562efa357 100644--- a/update.rdf+++ b/update.rdf@@ -7,13 +7,13 @@<r:Seq><r:li><r:Description>- <version>1.4.1386</version>+ <version>1.4.1394</version><targetApplication><r:Description><id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id><minVersion>16.0</minVersion><maxVersion>*</maxVersion>- <updateLink>http://tagspaces.com/releases/1.4/tagspaces.1.4.1386.xpi</updateLink>+ <updateLink>http://tagspaces.com/releases/1.4/tagspaces.1.4.1394.xpi</updateLink><updateInfoURL>http://tagspaces.com/releases/1.4/updateInfo.xml</updateInfoURL></r:Description></targetApplication>