Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 6bff3b8

Browse files
author
Ted Behling
committed
Based on config useProjectCwd, set cwd to the project root
1 parent f6e4db8 commit 6bff3b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export default {
2727
atom.config.observe('linter-shellcheck.userParameters', (value) => {
2828
this.userParameters = value.trim().split(' ').filter(Boolean);
2929
}),
30+
atom.config.observe('linter-shellcheck.useProjectCwd', (value) => {
31+
this.useProjectCwd = value;
32+
}),
3033
);
3134
},
3235

@@ -61,7 +64,8 @@ export default {
6164
}
6265

6366
const text = textEditor.getText();
64-
const cwd = path.dirname(filePath);
67+
const projectPath = atom.project.relativizePath(filePath)[0];
68+
const cwd = this.useProjectCwd && projectPath ? projectPath : path.dirname(filePath);
6569
const showAll = this.enableNotice;
6670
// The first -f parameter overrides any others
6771
const parameters = [].concat(['-f', 'gcc'], this.userParameters, ['-']);

0 commit comments

Comments
 (0)