Skip to content

Commit

Permalink
#1 fixing deprecated undefined handling of path.dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
g--o committed Apr 21, 2021
1 parent 0d0a89b commit 271f1e4
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 271f1e4

Please sign in to comment.