Skip to content

Commit

Permalink
Merge pull request #2 from g--o/fix/dirname-undefined
Browse files Browse the repository at this point in the history
#1 fixing deprecated undefined handling of path.dirname
  • Loading branch information
g--o committed Apr 21, 2021
2 parents 0d0a89b + 271f1e4 commit f50e934
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/minify-j-s.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,19 @@ export default {
load_paths(isDir, isOut) {
path = require("path");
editor = atom.workspace.getActiveTextEditor();
var filePath = "";

// get file path from editor
if (!editor)
filePath = DEFAULT_OUT_PATH;
else
filePath = editor.getPath();

if (!filePath) {
alert("Somehow couldn't determine a path, please select a file and try again");
return;
}

fileDir = path.dirname(filePath);

// auto complete current dir and build path.
Expand Down

0 comments on commit f50e934

Please sign in to comment.