@@ -15,7 +15,6 @@ var debug = require('./logging');
1515
1616var utils = require ( './fileStore.js' ) ;
1717var ns = require ( './vocab/ns.js' ) . ns ;
18- var metaExtension = '.meta' ;
1918var turtleExtension = '.ttl' ;
2019
2120module . exports = LDP ;
@@ -45,6 +44,7 @@ function LDP(argv) {
4544 // Processed
4645 ldp . leavePatchConnectionOpen = false ;
4746 ldp . suffixAcl = argv . suffixAcl || ".acl" ;
47+ ldp . suffixMeta = argv . suffixMeta || ".meta" ;
4848 ldp . suffixChanges = argv . suffixChanges || '.changes' ;
4949 ldp . suffixSSE = argv . suffixSSE || '.events' ;
5050
@@ -87,7 +87,7 @@ LDP.prototype.readFile = function (filename, callback) {
8787} ;
8888
8989LDP . prototype . readContainerMeta = function ( directory , callback ) {
90- fs . readFile ( directory + metaExtension , {
90+ fs . readFile ( directory + this . suffixMeta , {
9191 'encoding' : 'utf8'
9292 } , function ( err , data ) {
9393 if ( err ) {
@@ -144,7 +144,7 @@ LDP.prototype.listContainer = function (filename, uri, containerData, callback)
144144 function ( files , next ) {
145145
146146 async . each ( files , function ( file , cb ) {
147- if ( S ( file ) . endsWith ( metaExtension ) || S ( file ) . endsWith ( ldp . suffixAcl ) ) {
147+ if ( S ( file ) . endsWith ( ldp . suffixMeta ) || S ( file ) . endsWith ( ldp . suffixAcl ) ) {
148148 return cb ( null ) ;
149149 }
150150
@@ -165,12 +165,12 @@ LDP.prototype.listContainer = function (filename, uri, containerData, callback)
165165 var fileSubject = file ;
166166
167167 if ( stats . isDirectory ( ) ) {
168- metaFile = filename + file + '/' + metaExtension ;
168+ metaFile = filename + file + '/' + ldp . suffixMeta ;
169169 fileSubject += '/' ;
170170 } else if ( stats . isFile ( ) && S ( file ) . endsWith ( turtleExtension ) ) {
171171 metaFile = filename + file ;
172172 } else {
173- metaFile = filename + file + metaExtension ;
173+ metaFile = filename + file + ldp . suffixMeta ;
174174 }
175175 fileBaseUri = utils . filenameToBaseUri ( file , uri , ldp . root ) ;
176176
@@ -322,7 +322,7 @@ LDP.prototype.delete = function(filename, callback) {
322322} ;
323323
324324LDP . prototype . deleteContainerMetadata = function ( directory , callback ) {
325- return fs . unlink ( directory + metaExtension , function ( err , data ) {
325+ return fs . unlink ( directory + this . suffixMeta , function ( err , data ) {
326326 if ( err ) {
327327 debug . container ( "DELETE -- unlink() error: " + err ) ;
328328 return callback ( { status :404 , message : "Can't delete container: " + err } ) ;
@@ -447,15 +447,15 @@ LDP.prototype.createNewContainer = function (uri, containerPath, containerGraph,
447447} ;
448448
449449LDP . prototype . writeContainerMetadata = function ( directory , container , callback ) {
450- fs . writeFile ( directory + metaExtension , container , callback ) ;
450+ fs . writeFile ( directory + this . suffixMeta , container , callback ) ;
451451} ;
452452
453453LDP . prototype . isMetadataFile = function ( filename ) {
454- if ( path . extname ( filename ) === metaExtension )
454+ if ( path . extname ( filename ) === this . suffixMeta )
455455 return true ;
456456 return false ;
457457} ;
458458
459459LDP . prototype . hasContainerMetadata = function ( directory ) {
460- return fs . existsSync ( directory + metaExtension ) ;
460+ return fs . existsSync ( directory + this . suffixMeta ) ;
461461} ;
0 commit comments