Skip to content

Commit d51a983

Browse files
jrichter1mohitsuman
authored andcommitted
Remove recursive search from binary component selection (#1115)
1 parent 9226577 commit d51a983

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/openshift/component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,17 +524,12 @@ export class Component extends OpenShiftItem {
524524
}
525525

526526
if (!workspacePath) return null;
527-
528-
const paths = globby.sync(workspacePath.path, {
529-
expandDirectories: {
530-
files: ['*'],
531-
extensions: ['jar', 'war']
532-
}
533-
});
527+
const globPath = process.platform === 'win32' ? workspacePath.fsPath.replace(/\\/g, '/') : workspacePath.path;
528+
const paths = globby.sync(`${globPath}/*.+(jar|war)`, { extglob: true });
534529

535530
if (paths.length === 0) return window.showInformationMessage("No binary file present in the context folder selected. We currently only support .jar and .war files. If you need support for any other file, please raise an issue.");
536531

537-
const binaryFileObj: QuickPickItem[] = paths.map((file) => ({ label: `$(file-zip) ${file.split('/').pop()}`, description: `${file}`}));
532+
const binaryFileObj: QuickPickItem[] = paths.map((file) => ({ label: `$(file-zip) ${path.basename(file)}`, description: `${file}`}));
538533

539534
const binaryFile: any = await window.showQuickPick(binaryFileObj, {placeHolder: "Select binary file"});
540535

0 commit comments

Comments
 (0)