diff backends/directory.js @ 43:023f767662d3

Fix compatibility with strict mode of node 0.4 and some files without licence header.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 01 Mar 2011 11:58:15 +0100
parents dcf1f09f8cee
children fd69d35cf2e6
line wrap: on
line diff
--- a/backends/directory.js
+++ b/backends/directory.js
@@ -17,6 +17,8 @@
  *  along with PSĜS.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+'use strict';
+
 var fs = require('fs');
 var Node = require('../nodes').Node;
 var backend = exports;
@@ -27,9 +29,9 @@ backend.save = function(dir) {
 
 	fs.stat(dir, function(err, stats) {
 		if (err)
-			fs.mkdir(dir, 0755);
+			fs.mkdir(dir, 509); // 0755 in decimal
 		else if (!stats.isDirectory()) {
-			console.log('\033[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\033[0m');
+			console.log('\x1b[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\x1b[0m');
 			process.exit(1);
 		}
 
@@ -77,9 +79,9 @@ backend.load = function(dir) {
 
 	fs.stat(dir, function(err, stats) {
 		if (err)
-			fs.mkdir(dir, 0755);
+			fs.mkdir(dir, 509); // 0755 in decimal
 		else if (!stats.isDirectory()) {
-			console.log('\033[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\033[0m');
+			console.log('\x1b[1;41mThe file “' + dir + '” isn’t a directory. Exiting.\x1b[0m');
 			process.exit(1);
 		}