Changeset 71a4b1
- Timestamp:
- Oct 15, 2014, 3:04:47 PM (6 years ago)
- Branches:
- ng_0.9
- Children:
- d5349d
- Parents:
- 079fc3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/vI_rdfDatasource.js
r079fc3 r71a4b1 51 51 } 52 52 53 function initWithFilePath_tryDelimiters(_nsILocalFile, path, filename) { 54 try { 55 Log.debug("Filename try linux delimiter: '" + path + "/" + filename + "'"); 56 _nsILocalFile.initWithPath(path + "/" + filename); 57 } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) { 58 try { 59 Log.debug("Filename try windows delimiter: '" + path + "\\" + filename + "'"); 60 _nsILocalFile.initWithPath(path + "\\" + filename); 61 } 62 catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) { 63 Log.debug("Filename not valid: '" + path + "[\\/]" + filename + "'"); 64 Log.debug("can't open rdfDatasource - storage won't work"); 65 var debugMsg = "Filename not valid: '" + path + "\\" + filename + "'\n" + 66 "Filename not valid: '" + path + "/" + filename + "'\n" + 67 "Virtual Identity Storage won't work.\n\n" + 68 "Please report this issue with filename on https://www.absorb.it/virtual-id\n\n" + 69 "You can just copy the lines below in your browser to create a ticket\n\n" + 70 "https://www.absorb.it/virtual-id/newticket?summary=RDF Filename Error&description=Filename " + path + "[\\/]" + filename + " for rdf not valid" 71 get3PaneWindow().alert(debugMsg); 72 return; 73 } 74 } 75 }; 76 53 77 rdfDatasource.prototype = { 54 78 _extVersion : null, … … 58 82 _rdfDataSource : null, 59 83 _rdfFileName : null, 60 _rdfDelimiter : null,61 84 _rdfNS : "http://virtual-id.absorb.it/", 62 85 _rdfNSStorage : "vIStorage", … … 128 151 129 152 // Log.debug("_openRdfDataSource"); 130 try { 131 Log.debug("Filename try linux delimiter: '" + file.path + "/" + this._rdfFileName + "'"); 132 newFile.initWithPath(file.path + "/" + this._rdfFileName); 133 // Log.debug("success"); 134 this._rdfDelimiter = "/"; 135 } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) { 136 try { 137 Log.debug("Filename try windows delimiter: '" + file.path + "\\" + this._rdfFileName + "'"); 138 newFile.initWithPath(file.path + "\\" + this._rdfFileName); 139 // Log.debug("success"); 140 this._rdfDelimiter = "\\"; 141 } 142 catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) { 143 Log.debug("Filename not valid: '" + file.path + "[\\/]" + this._rdfFileName + "'"); 144 Log.debug("can't open rdfDatasource - storage won't work"); 145 var debugMsg = "Filename not valid: '" + file.path + "\\" + this._rdfFileName + "'\n" + 146 "Filename not valid: '" + file.path + "/" + this._rdfFileName + "'\n" + 147 "Virtual Identity Storage won't work.\n\n" + 148 "Please report this issue with filename on https://www.absorb.it/virtual-id\n\n" + 149 "You can just copy the lines below in your browser to create a ticket\n\n" + 150 "https://www.absorb.it/virtual-id/newticket?summary=RDF Filename Error&description=Filename " + file.path + "[\\/]" + this._rdfFileName + " for rdf not valid" 151 get3PaneWindow().alert(debugMsg); 152 return; 153 } 154 } 153 initWithFilePath_tryDelimiters(newFile, file.path, this._rdfFileName); 154 155 155 var fileURI = protoHandler.newFileURI(newFile); 156 156 … … 425 425 var found = false; 426 426 var accounts = getAccountsArray(); 427 var identity = null; 427 428 for (let acc = 0; acc < accounts.length; acc++) { 428 429 let account = accounts[acc]; 429 430 let identities = getIdentitiesArray(account); 430 431 for (let i = 0; i < identities.length; i++) { 431 letidentity = identities[i];432 identity = identities[i]; 432 433 if (id == identity.key) { found = true; break; } 433 434 } … … 579 580 580 581 export : function(rdfFileName) { 582 Log.debug("vI_rdfDatasource export: " + rdfFileName + "\n"); 581 583 var filePicker = Components.classes["@mozilla.org/filepicker;1"] 582 584 .createInstance(Components.interfaces.nsIFilePicker); … … 590 592 var file = Components.classes["@mozilla.org/file/directory_service;1"] 591 593 .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); 592 rdfDataFile.initWithPath(file.path + this._rdfDelimiter + rdfFileName);593 594 595 initWithFilePath_tryDelimiters(rdfDataFile, file.path, rdfFileName); 594 596 rdfDataFile.copyTo(filePicker.file.parent,filePicker.file.leafName); 595 597 } … … 1151 1153 var file = Components.classes["@mozilla.org/file/directory_service;1"] 1152 1154 .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); 1153 importRdfDataFile.initWithPath(file.path + this._rdfDelimiter + this._rdfFileName + "_import"); 1155 1156 initWithFilePath_tryDelimiters(importRdfDataFile, file.path, this._rdfFileName + "_import"); 1154 1157 filePicker.file.copyTo(importRdfDataFile.parent,importRdfDataFile.leafName); 1155 1158
Note: See TracChangeset
for help on using the changeset viewer.