@@ -33,6 +33,23 @@ export class GenerateJarExecutor implements IExportJarStepExecutor {
33
33
return false ;
34
34
}
35
35
}
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
+ }
36
53
return window . withProgress ( {
37
54
location : ProgressLocation . Window ,
38
55
title : "Exporting Jar : Generating jar..." ,
@@ -42,30 +59,6 @@ export class GenerateJarExecutor implements IExportJarStepExecutor {
42
59
token . onCancellationRequested ( ( ) => {
43
60
return reject ( ) ;
44
61
} ) ;
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
- }
69
62
const exportResult : IExportResult = await Jdtls . exportJar ( basename ( stepMetadata . mainMethod ) , stepMetadata . elements , destPath ) ;
70
63
if ( exportResult . result === true ) {
71
64
stepMetadata . outputPath = destPath ;
0 commit comments