comparison backends/file.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 e007a6364bf0
children 99bd1d1ac071
comparison
equal deleted inserted replaced
42:07ca0263a53f 43:023f767662d3
14 * GNU Affero General Public License for more details. 14 * GNU Affero General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Affero General Public License 16 * You should have received a copy of the GNU Affero General Public License
17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. 17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19
20 'use strict';
19 21
20 var fs = require('fs'); 22 var fs = require('fs');
21 var Node = require('../nodes').Node; 23 var Node = require('../nodes').Node;
22 var backend = exports; 24 var backend = exports;
23 25
80 82
81 fs.stat(file, function(err, stats) { 83 fs.stat(file, function(err, stats) {
82 if (err) 84 if (err)
83 fs.writeFileSync(file, '{}'); 85 fs.writeFileSync(file, '{}');
84 else if (!stats.isFile()) { 86 else if (!stats.isFile()) {
85 console.log('\033[1;41mThe file “' + file + '” isn’t a regular file. Exiting.\033[0m'); 87 console.log('\x1b[1;41mThe file “' + file + '” isn’t a regular file. Exiting.\x1b[0m');
86 process.exit(1); 88 process.exit(1);
87 } 89 }
88 90
89 var data = fs.readFileSync(file); 91 var data = fs.readFileSync(file);
90 var obj = eval('('+data+')'); 92 var obj = eval('('+data+')');