Skip to content

Commit 001da0b

Browse files
authored
optimize code
1 parent d93442d commit 001da0b

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/KeilXmlParser.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -789,21 +789,16 @@ class ARMParser extends KeilParser<KeilARMOption> {
789789
}
790790
if (total_cnt > 0) {
791791
// Copy files to compate Keil User Commands
792-
if (env['KEIL_OUTPUT_NAME']) {
793-
eideOption.afterBuildTasks.splice(0, 0, {
794-
"name": '[Copy linker output for Keil User Commands]',
795-
"command": `$<cd:mdk-proj-dir> && mkdir \${KEIL_OUTPUT_DIR} & copy "\${OutDir}\\\${ProjectName}.axf" "\${KEIL_OUTPUT_DIR}\\\${KEIL_OUTPUT_NAME}.axf"`,
796-
"disable": actived_cnt == 0,
797-
"abortAfterFailed": true
798-
});
799-
} else {
800-
eideOption.afterBuildTasks.splice(0, 0, {
801-
"name": '[Copy linker output for Keil User Commands]',
802-
"command": `$<cd:mdk-proj-dir> && mkdir \${KEIL_OUTPUT_DIR} & copy "\${OutDir}\\\${ProjectName}.axf" "\${KEIL_OUTPUT_DIR}\\\${ProjectName}.axf"`,
803-
"disable": actived_cnt == 0,
804-
"abortAfterFailed": true
805-
});
792+
const copyFilesCmd = {
793+
"name": '[Copy linker output for Keil User Commands]',
794+
"command": `$<cd:mdk-proj-dir> && mkdir \${KEIL_OUTPUT_DIR} & copy "\${OutDir}\\\${ProjectName}.axf" "\${KEIL_OUTPUT_DIR}\\\${KEIL_OUTPUT_NAME}.axf"`,
795+
"disable": actived_cnt == 0,
796+
"abortAfterFailed": true
797+
};
798+
if (!env['KEIL_OUTPUT_NAME']) {
799+
copyFilesCmd['command'] = copyFilesCmd['command'].replace('${KEIL_OUTPUT_NAME}', '${ProjectName}');
806800
}
801+
eideOption.afterBuildTasks.splice(0, 0, copyFilesCmd);
807802
}
808803
if (mdk_CreateLib) {
809804
// Make eide output lib instead of elf

0 commit comments

Comments
 (0)