Skip to content

Commit 0283b8b

Browse files
authored
bugfix: Show the status bar message after the generating task begins (#352)
1 parent b68cdab commit 0283b8b

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

src/exportJarSteps/GenerateJarExecutor.ts

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@ export class GenerateJarExecutor implements IExportJarStepExecutor {
3333
return false;
3434
}
3535
}
36+
stepMetadata.outputPath = normalize(stepMetadata.outputPath);
37+
let destPath = "";
38+
if (stepMetadata.outputPath === SETTING_ASKUSER) {
39+
const outputUri: Uri = await saveDialog(stepMetadata.workspaceFolder.uri, "Generate");
40+
destPath = outputUri.fsPath;
41+
} else {
42+
// Both the absolute path and the relative path (to workspace folder) are supported.
43+
destPath = (isAbsolute(stepMetadata.outputPath)) ?
44+
stepMetadata.outputPath :
45+
join(stepMetadata.workspaceFolder.uri.fsPath, stepMetadata.outputPath);
46+
// Since both the specific target folder and the specific target file are supported,
47+
// we regard a path as a file if it ends with ".jar". Otherwise, it was regarded as a folder.
48+
if (extname(stepMetadata.outputPath) !== ".jar") {
49+
destPath = join(destPath, stepMetadata.workspaceFolder.name + ".jar");
50+
}
51+
await ensureDir(dirname(destPath));
52+
}
3653
return window.withProgress({
3754
location: ProgressLocation.Window,
3855
title: "Exporting Jar : Generating jar...",
@@ -42,30 +59,6 @@ export class GenerateJarExecutor implements IExportJarStepExecutor {
4259
token.onCancellationRequested(() => {
4360
return reject();
4461
});
45-
stepMetadata.outputPath = normalize(stepMetadata.outputPath);
46-
let destPath = "";
47-
if (stepMetadata.outputPath === SETTING_ASKUSER) {
48-
const outputUri: Uri = await saveDialog(stepMetadata.workspaceFolder.uri, "Generate");
49-
if (outputUri === undefined) {
50-
return reject();
51-
}
52-
destPath = outputUri.fsPath;
53-
} else {
54-
// Both the absolute path and the relative path (to workspace folder) are supported.
55-
destPath = (isAbsolute(stepMetadata.outputPath)) ?
56-
stepMetadata.outputPath :
57-
join(stepMetadata.workspaceFolder.uri.fsPath, stepMetadata.outputPath);
58-
// Since both the specific target folder and the specific target file are supported,
59-
// we regard a path as a file if it ends with ".jar". Otherwise, it was regarded as a folder.
60-
if (extname(stepMetadata.outputPath) !== ".jar") {
61-
destPath = join(destPath, stepMetadata.workspaceFolder.name + ".jar");
62-
}
63-
try {
64-
await ensureDir(dirname(destPath));
65-
} catch (e) {
66-
return reject(e);
67-
}
68-
}
6962
const exportResult: IExportResult = await Jdtls.exportJar(basename(stepMetadata.mainMethod), stepMetadata.elements, destPath);
7063
if (exportResult.result === true) {
7164
stepMetadata.outputPath = destPath;

0 commit comments

Comments
 (0)