Skip to content

Commit

Permalink
fix(watchman): allow watching workspaces at /tmp/some-dir
Browse files Browse the repository at this point in the history
Fixes #4616
  • Loading branch information
oxalica committed May 7, 2023
1 parent 3014125 commit 20d944b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/watchman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,11 @@ export default class Watchman {
}

/**
* Exclude user's home, driver, tmpdir
* Exclude root, user's home, driver and tmpdir, but allow sub-directories under them.
*/
export function isValidWatchRoot(root: string): boolean {
if (root == '/' || root == '/tmp' || root == '/private/tmp') return false
if (root == '/' || root == '/tmp' || root == '/private/tmp' || root == os.tmpdir()) return false
if (isParentFolder(root, os.homedir(), true)) return false
if (path.parse(root).base == root) return false
if (root.startsWith('/tmp/') || root.startsWith('/private/tmp/')) return false
if (isParentFolder(os.tmpdir(), root, true)) return false
return true
}

0 comments on commit 20d944b

Please sign in to comment.