Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.

Commit 27f4b93

Browse files
author
Jens Lind
committed
Check if finder path has gruntfile
1 parent e5d7714 commit 27f4b93

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/Grunt.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
const spawn = require('child_process').spawn
44
const notifier = require('node-notifier')
55
const getGruntTasks = require('get-grunt-tasks')
6+
const fs = require('fs')
7+
const path = require('path')
68

79
global.processes = {}
810

11+
exports.hasFile = function (p, cb) {
12+
fs.stat(path.join(p, 'gruntfile.js'), function (err, stats) {
13+
if (err) return cb(false)
14+
return cb(true)
15+
})
16+
}
17+
918
exports.getTasks = function () {
1019
return new Promise(function (resolve, reject) {
1120
let current = window.localStorage.getItem('current')

src/tray.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ void (function () {
105105
if (window.localStorage.getItem('followFinder') === 'true') {
106106
finderInterval = setInterval(function () {
107107
currentPath(function (err, path) {
108-
if (!err && window.localStorage.getItem('current') !== path) {
109-
window.localStorage.setItem('current', path)
108+
grunt.hasFile(path, function (status) {
109+
if (!err && window.localStorage.getItem('current') !== path && status) {
110+
window.localStorage.setItem('current', path)
110111

111-
rebuild()
112-
}
112+
rebuild()
113+
}
114+
})
113115
})
114116
}, FINDER_UPDATE)
115117
}

0 commit comments

Comments
 (0)