Skip to content

Commit

Permalink
save generated files in same folder as source file
Browse files Browse the repository at this point in the history
- and remove checking for php (unnecessary)
  • Loading branch information
apppro123 committed Jan 1, 2021
1 parent 81f74ef commit c88c1ca
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as vscode from "vscode";
import * as path from "path";
import { config, reloadConfig } from './config';

export const EXT_ID = 'php-minifier';
export const EXT_ID = "php-minifier";

export function isMinified(doc: vscode.TextDocument): boolean {
const baseName = path.basename(doc.fileName);
Expand All @@ -23,27 +22,14 @@ export function getOutPath(doc: vscode.TextDocument): string {

outNameParts.pop();

if (file.languageId === "php") {
outNameParts.push("min");
}
outNameParts.push("min");

outNameParts.push(file.extname.replace(".", ""));
const baseOut = outNameParts.join(".");

let outPath: string;

if (file.languageId === "php") {
if (vscode.workspace.workspaceFolders) {
outPath = path.join(
vscode.workspace.workspaceFolders[0].uri.fsPath,
baseOut
);
} else {
outPath = path.join(file.dirname, baseOut);
}
} else {
outPath = "";
}
outPath = path.join(file.dirname, baseOut);

return outPath;
}
}

0 comments on commit c88c1ca

Please sign in to comment.