Changeset 6d955a


Ignore:
Timestamp:
Sep 27, 2014, 4:32:05 PM (6 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
fc272b
Parents:
54ce49
Message:

fixed problem with delimiter detection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/vI_rdfDatasource.js

    r54ce49 r6d955a  
    5858    _rdfDataSource :    null,
    5959    _rdfFileName :      null,
     60    _rdfDelimiter :     null,
    6061    _rdfNS :            "http://virtual-id.absorb.it/",
    6162    _rdfNSStorage :     "vIStorage",
     
    125126            .getService(Components.interfaces.nsIProperties)
    126127            .get("ProfD", Components.interfaces.nsIFile);
    127         var delimiter = (file.path.match(/\\/))?"\\":"/";
    128 
     128       
     129//         Log.debug("_openRdfDataSource");
    129130        try {
    130             newFile.initWithPath(file.path + delimiter + this._rdfFileName);
     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 = "/";
    131135        } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) {
    132             var debugMsg = "Filename not valid: '" + file.path + delimiter + this._rdfFileName + "'\n" +
    133                 "Virtual Identity Storage won't work.\n\n" +
    134                 "Please report this issue with filename on https://www.absorb.it/virtual-id\n\n" +
    135                 "You can just copy the lines below in your browser to create a ticket\n\n" +
    136                 "https://www.absorb.it/virtual-id/newticket?summary=RDF Filename Error&description=Filename " + file.path + delimiter + this._rdfFileName + " for rdf not valid"
    137             get3PaneWindow().alert(debugMsg);
    138             log.debug("Filename not valid: '" + file.path + delimiter + this._rdfFileName + "'");
    139             log.debug("can't open rdfDatasource - storage won't work");
    140             return;
     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            }
    141154        }
    142155        var fileURI = protoHandler.newFileURI(newFile);
     
    577590            var file = Components.classes["@mozilla.org/file/directory_service;1"]
    578591                .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
    579             var delimiter = (file.path.match(/\\/))?"\\":"/";
    580             rdfDataFile.initWithPath(file.path + delimiter + rdfFileName);
     592            rdfDataFile.initWithPath(file.path + this._rdfDelimiter + rdfFileName);
    581593
    582594            rdfDataFile.copyTo(filePicker.file.parent,filePicker.file.leafName);
     
    11391151            var file = Components.classes["@mozilla.org/file/directory_service;1"]
    11401152                .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
    1141             var delimiter = (file.path.match(/\\/))?"\\":"/";
    1142             importRdfDataFile.initWithPath(file.path + delimiter + this._rdfFileName + "_import");
     1153            importRdfDataFile.initWithPath(file.path + this._rdfDelimiter + this._rdfFileName + "_import");
    11431154            filePicker.file.copyTo(importRdfDataFile.parent,importRdfDataFile.leafName);
    11441155
Note: See TracChangeset for help on using the changeset viewer.