Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"theme": "dark"
},
"publisher": "Katsute",
"version": "2.10.0",
"version": "2.9.2",
"private": true,
"engines": {
"vscode": "^1.85.0"
Expand Down
10 changes: 6 additions & 4 deletions src/extension/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@
import { homedir } from "os";
import { workspace } from "vscode";

import { escape as esc } from "../lib/glob";

const home: string = homedir();

export const resolve: (str: string) => string = (str: string) =>
str.replace(/\${(.*)}/g, (_, envvar) => {
str.replace(/\${(.*?)}/g, (_, envvar) => {
if(envvar == "vscode:workspace" && workspace.workspaceFolders && workspace.workspaceFolders.length > 0 && workspace.workspaceFolders[0].uri){
return workspace.workspaceFolders[0].uri.fsPath.toString();
return esc(workspace.workspaceFolders[0].uri.fsPath.toString());
}else if(envvar == "user:home"){
return home;
return esc(home);
}else if(envvar in process.env){
return process.env[envvar] || '';
return esc(process.env[envvar] || '');
}else{
return '';
}
Expand Down
7 changes: 5 additions & 2 deletions src/lib/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ const options: GlobOptions = {
nodir: true
}

export const escape: (path: Uri) => string = (path: Uri) =>
esc(path.fsPath.replace(/\\/g, '/'));
export const escapePath: (path: Uri) => string = (path: Uri) =>
escape(path.fsPath);

export const escape: (path: string) => string = (path: string) =>
esc(path.replace(/\\/g, '/'));

export const count: (glob: string | string[]) => number = (glob: string | string[]) => {
let i = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/menu/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { extensions } from "../extension/inject";
import { UI, get as getConfig, update } from "../extension/config";

import { appendS } from "../lib/string";
import { count, escape as esc } from "../lib/glob";
import { count, escapePath } from "../lib/glob";
import { unique } from "../lib/array";
import { CommandQuickPickItem, quickPickItem, separator, showInputBox, showQuickPick } from "../lib/vscode";

Expand Down Expand Up @@ -125,7 +125,7 @@ export const show: (ui: UI) => void = (ui: UI) =>{
openLabel: "Select Image",
filters: {"Images": extensions()}
}).then((files?: Uri[]) =>
files && add(ui, files.map(file => esc(file)))
files && add(ui, files.map(file => escapePath(file)))
)
}),
quickPickItem({ // folder
Expand All @@ -139,7 +139,7 @@ export const show: (ui: UI) => void = (ui: UI) =>{
canSelectMany: true,
openLabel: "Select Folder"
}).then((files?: Uri[]) =>
files && add(ui, files.map(file => `${esc(file)}/**`))
files && add(ui, files.map(file => `${escapePath(file)}/**`))
)
}),
quickPickItem({ // glob
Expand Down