Skip to content

Commit

Permalink
Only init pathwatcher when a file is watched. Fixes GH-98.
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Apr 19, 2014
1 parent 6ec2bff commit faff6fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

try { var PathWatcher = require('./pathwatcher'); } catch (err) { }
var PathWatcher = null;
var statpoll = require('./statpoll.js');
var helper = require('./helper');
var fs = require('graceful-fs');
Expand All @@ -20,6 +20,10 @@ var renameWaiting = null;
var renameWaitingFile = null;

var platform = module.exports = function(file, cb) {
if (PathWatcher == null) {
PathWatcher = require('./pathwatcher');
}

// Ignore non-existent files
if (!fs.existsSync(file)) return;

Expand Down

0 comments on commit faff6fb

Please sign in to comment.