Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1914 from mozilla/node_0.8.x_support

Node 0.8.x support
  • Loading branch information...
commit 5ccc669a52f38941e5607abc3f4fa542d82f3207 2 parents 227a577 + 3647e28
@lloyd lloyd authored
View
9 lib/db/json.js
@@ -16,6 +16,13 @@ logger = require('../logging.js').logger,
configuration = require('../configuration.js'),
temp = require('temp');
+// existsSync moved from path in 0.6.x to fs in 0.8.x
+if (typeof fs.existsSync === 'function') {
+ var existsSync = fs.existsSync;
+} else {
+ var existsSync = path.existsSync;
+}
+
// a little alias for stringify
const ESC = JSON.stringify;
@@ -59,7 +66,7 @@ function flush() {
function sync() {
// the database not existing yet just means its empty, don't log an error
- if (path.existsSync(dbPath)) {
+ if (existsSync(dbPath)) {
try {
db = JSON.parse(fs.readFileSync(dbPath));
View
11 lib/i18n.js
@@ -21,6 +21,13 @@ var logger = require('./logging.js').logger,
util = require('util'),
fs = require('fs');
+// existsSync moved from path in 0.6.x to fs in 0.8.x
+if (typeof fs.existsSync === 'function') {
+ var existsSync = fs.existsSync;
+} else {
+ var existsSync = path.existsSync;
+}
+
const BIDI_RTL_LANGS = ['ar', 'db-LB', 'fa', 'he'];
var mo_cache = {};
@@ -66,8 +73,8 @@ exports.abide = function (options) {
default_locale = localeFrom(options.default_lang);
mo_cache[l] = {
- mo_exists: path.existsSync(mo_file_path(l)),
- json_exists: path.existsSync(json_file_path(l)),
+ mo_exists: existsSync(mo_file_path(l)),
+ json_exists: existsSync(json_file_path(l)),
gt: null
};
if (l !== debug_locale) {
View
9 lib/logging.js
@@ -20,12 +20,19 @@ configuration = require("./configuration"),
path = require('path'),
fs = require('fs');
+// existsSync moved from path in 0.6.x to fs in 0.8.x
+if (typeof fs.existsSync === 'function') {
+ var existsSync = fs.existsSync;
+} else {
+ var existsSync = path.existsSync;
+}
+
// go through the configuration and determine log location
var log_path = path.join(configuration.get('var_path'), 'log');
// simple inline function for creation of dirs
function mkdir_p(p) {
- if (!path.existsSync(p)) {
+ if (!existsSync(p)) {
mkdir_p(path.dirname(p));
fs.mkdirSync(p, "0755");
}
View
9 lib/metrics.js
@@ -24,6 +24,13 @@ path = require('path'),
fs = require('fs'),
urlparse = require('urlparse');
+// existsSync moved from path in 0.6.x to fs in 0.8.x
+if (typeof fs.existsSync === 'function') {
+ var existsSync = fs.existsSync;
+} else {
+ var existsSync = path.existsSync;
+}
+
// go through the configuration and determine log location
// for now we only log to one place
// FIXME: separate logs depending on purpose?
@@ -33,7 +40,7 @@ var LOGGER;
// simple inline function for creation of dirs
function mkdir_p(p) {
- if (!path.existsSync(p)) {
+ if (!existsSync(p)) {
mkdir_p(path.dirname(p));
fs.mkdirSync(p, "0755");
}

0 comments on commit 5ccc669

Please sign in to comment.
Something went wrong with that request. Please try again.