Skip to content

Commit 8d27b84

Browse files
committed
fix dir issue with empty project
1 parent 6e013ab commit 8d27b84

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/modules/dir/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"use strict";
22
function dirReducer(dir) {
3-
if (!atom) {
4-
throw new Error('No project directory found. Atom may not be initialized.');
5-
}
63
if (atom && atom.project.rootDirectories.length > 0) {
74
return atom.project.rootDirectories[0].path;
85
}
6+
return '';
97
}
108
Object.defineProperty(exports, "__esModule", { value: true });
119
exports.default = dirReducer;

src/modules/dir/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
*/
66
export default function dirReducer(
77
dir: string
8-
): string|void {
9-
if (!atom) {
10-
throw new Error('No project directory found. Atom may not be initialized.');
11-
}
8+
): string {
129
if (atom && atom.project.rootDirectories.length > 0) {
1310
return atom.project.rootDirectories[0].path;
1411
}
12+
return '';
1513
}

0 commit comments

Comments
 (0)