Skip to content

Commit

Permalink
Merge into utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wltsmrz committed Jul 18, 2012
1 parent eb893cf commit 3a7c65a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/haraka
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var fs = require('fs'),
"f": ["--force"],
},
parsed = nopt(knownOpts, shortHands, process.argv, 2),
existsSync = require('../existsSync');
existsSync = require('../utils').existsSync;

var usage = [
"\033[32;40mHaraka.js\033[0m — A Node.js Email Server project",
Expand Down
6 changes: 0 additions & 6 deletions existsSync.js

This file was deleted.

5 changes: 2 additions & 3 deletions outbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ var config = require('./config');
var constants = require('./constants');
var trans = require('./transaction');
var plugins = require('./plugins');
var date_to_str = require('./utils').date_to_str;
var Address = require('./address').Address;
var date_to_str = utils.date_to_str;
var existsSync = utils.existsSync;

var core_consts = require('constants');
var WRITE_EXCL = core_consts.O_CREAT | core_consts.O_TRUNC | core_consts.O_WRONLY | core_consts.O_EXCL;
Expand All @@ -33,8 +34,6 @@ var uniq = Math.round(Math.random() * MAX_UNIQ);
var max_concurrency = config.get('outbound.concurrency_max') || 100;
var queue_count = 0;

var existsSync = require('./existsSync')

exports.list_queue = function () {
this._load_cur_queue("_list_file");
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/queue/quarantine.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var path = require('path');
var fs = require('fs');

var existsSync = require('../../existsSync');
var existsSync = require('../../utils').existsSync;

exports.register = function () {
this.register_hook('queue','quarantine');
Expand Down
5 changes: 5 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,8 @@ exports.encode_qp = function (str) {
return broken_lines + str;
}

var versions = process.version.split('.');
, version = Number(versions[0].substring(1));
, subversion = Number(versions[1]);

exports.existsSync = require((version > 0 || subversion >= 8) ? 'fs' : 'path').existsSync;

0 comments on commit 3a7c65a

Please sign in to comment.