@@ -306,7 +306,7 @@ export abstract class KeilParser<T> {
306306
307307 abstract ParseData ( ) : KeilParserResult < T > [ ] ;
308308
309- abstract SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , deviceInfo ?: CurrentDevice ) : void ;
309+ abstract SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , keilOutputDir : File , deviceInfo ?: CurrentDevice ) : void ;
310310}
311311
312312//----
@@ -504,7 +504,7 @@ class C51Parser extends KeilParser<KeilC51Option> {
504504 }
505505 }
506506
507- SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , deviceInfo ?: CurrentDevice ) : void {
507+ SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , keilOutputDir : File , deviceInfo ?: CurrentDevice ) : void {
508508
509509 const prjConfig : ProjectConfiguration < any > = prj . GetConfiguration ( ) ;
510510 const target = this . doc . Project . Targets . Target [ 0 ] ;
@@ -534,14 +534,15 @@ class C51Parser extends KeilParser<KeilC51Option> {
534534 target . TargetOption . TargetCommonOption . Device = devName ;
535535 target . TargetOption . TargetCommonOption . Vendor = vendor ;
536536
537- const outFolder = File . normalize ( prjConfig . config . outDir ) ;
538- target . TargetOption . TargetCommonOption . OutputDirectory = `.\\${ outFolder } \\Keil\\` ;
539- target . TargetOption . TargetCommonOption . ListingPath = `.\\${ outFolder } \\Keil\\` ;
537+ const outFolderAbs = prj . ToAbsolutePath ( prjConfig . config . outDir ) ;
538+ const outFolder = File . ToLocalPath ( keilOutputDir . ToRelativePath ( outFolderAbs ) || outFolderAbs ) ;
539+ target . TargetOption . TargetCommonOption . OutputDirectory = `${ outFolder } \\Keil\\` ;
540+ target . TargetOption . TargetCommonOption . ListingPath = `${ outFolder } \\Keil\\` ;
540541 target . TargetOption . TargetCommonOption . OutputName = target . TargetName ;
541542
542543 target . TargetOption . Target51 . C51 . VariousControls . IncludePath = mergedDep . incList
543544 . map ( s => prj . resolveEnvVar ( s ) )
544- . map ( inc => File . ToLocalPath ( prj . toRelativePath ( inc ) ) )
545+ . map ( inc => { const abs = File . isAbsolute ( inc ) ? inc : prj . ToAbsolutePath ( inc ) ; return File . ToLocalPath ( keilOutputDir . ToRelativePath ( abs ) || abs ) ; } )
545546 . join ( ';' ) ;
546547
547548 target . TargetOption . Target51 . C51 . VariousControls . Define = mergedDep . defineList . join ( "," ) ;
@@ -563,7 +564,7 @@ class C51Parser extends KeilParser<KeilC51Option> {
563564 const fileElement = {
564565 FileName : _f . file . name ,
565566 FileType : this . getFileType ( _f . file ) . toString ( ) ,
566- FilePath : prj . ToRelativePath ( _f . file . path ) || _f . file . path
567+ FilePath : File . ToLocalPath ( keilOutputDir . ToRelativePath ( _f . file . path ) || _f . file . path )
567568 } ;
568569
569570 this . setFileDisableFlag ( fileElement , _f . disabled ) ;
@@ -1169,7 +1170,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
11691170 return result ;
11701171 }
11711172
1172- private setOption ( targetOptionObj : any , prj : AbstractProject ) {
1173+ private setOption ( targetOptionObj : any , prj : AbstractProject , keilOutputDir : File ) {
11731174
11741175 const armAdsObj = targetOptionObj . TargetArmAds ;
11751176 const prjConfig = < ProjectConfiguration < ArmBaseCompileData > > prj . GetConfiguration ( ) ;
@@ -1213,7 +1214,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
12131214 LDads . umfTarg = config . useCustomScatterFile ? '0' : '1' ;
12141215 if ( config . scatterFilePath ) {
12151216 const absPath = prj . ToAbsolutePath ( config . scatterFilePath ) ;
1216- LDads . ScatterFile = this . ToRelativePath ( absPath ) ;
1217+ LDads . ScatterFile = File . ToLocalPath ( keilOutputDir . ToRelativePath ( absPath ) || absPath ) ;
12171218 } else {
12181219 LDads . ScatterFile = '' ;
12191220 }
@@ -1317,7 +1318,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
13171318 }
13181319 }
13191320
1320- SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , deviceInfo ?: CurrentDevice ) : void {
1321+ SetKeilXml ( prj : AbstractProject , fileGroups : FileGroup [ ] , keilOutputDir : File , deviceInfo ?: CurrentDevice ) : void {
13211322
13221323 const prjConfig : ProjectConfiguration < any > = prj . GetConfiguration ( ) ;
13231324 const target = this . doc . Project . Targets . Target [ 0 ] ;
@@ -1366,17 +1367,19 @@ class ARMParser extends KeilParser<KeilARMOption> {
13661367 }
13671368
13681369 target . TargetName = prjConfig . config . name ;
1370+ target . uAC6 = prj . getToolchain ( ) . name === 'AC6' ? '1' : '0' ;
13691371 target . TargetOption . TargetCommonOption . Device = devName ;
13701372 target . TargetOption . TargetCommonOption . Vendor = vendor ;
13711373
1372- const outFolder = File . normalize ( prjConfig . config . outDir ) ;
1373- target . TargetOption . TargetCommonOption . OutputDirectory = `.\\${ outFolder } \\Keil\\` ;
1374- target . TargetOption . TargetCommonOption . ListingPath = `.\\${ outFolder } \\Keil\\` ;
1374+ const outFolderAbs = prj . ToAbsolutePath ( prjConfig . config . outDir ) ;
1375+ const outFolder = File . ToLocalPath ( keilOutputDir . ToRelativePath ( outFolderAbs ) || outFolderAbs ) ;
1376+ target . TargetOption . TargetCommonOption . OutputDirectory = `${ outFolder } \\Keil\\` ;
1377+ target . TargetOption . TargetCommonOption . ListingPath = `${ outFolder } \\Keil\\` ;
13751378 target . TargetOption . TargetCommonOption . OutputName = target . TargetName ;
13761379
13771380 target . TargetOption . TargetArmAds . Cads . VariousControls . IncludePath = mergedDep . incList
13781381 . map ( s => prj . resolveEnvVar ( s ) )
1379- . map ( inc => File . ToLocalPath ( prj . toRelativePath ( inc ) ) )
1382+ . map ( inc => { const abs = File . isAbsolute ( inc ) ? inc : prj . ToAbsolutePath ( inc ) ; return File . ToLocalPath ( keilOutputDir . ToRelativePath ( abs ) || abs ) ; } )
13801383 . join ( ';' ) ;
13811384
13821385 target . TargetOption . TargetArmAds . Cads . VariousControls . Define = mergedDep . defineList . join ( "," ) ; // C/CPP
@@ -1387,7 +1390,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
13871390 target . TargetOption . TargetArmAds . Aads . VariousControls . Define = defines . join ( "," ) ; // ASM
13881391 }
13891392
1390- this . setOption ( target . TargetOption , prj ) ;
1393+ this . setOption ( target . TargetOption , prj , keilOutputDir ) ;
13911394
13921395 const nGroups : any [ ] = [ ] ;
13931396
@@ -1404,7 +1407,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
14041407 const fileElement = {
14051408 FileName : _f . file . name ,
14061409 FileType : this . getFileType ( _f . file ) . toString ( ) ,
1407- FilePath : prj . ToRelativePath ( _f . file . path ) || _f . file . path
1410+ FilePath : File . ToLocalPath ( keilOutputDir . ToRelativePath ( _f . file . path ) || _f . file . path )
14081411 } ;
14091412
14101413 this . setFileDisableFlag ( fileElement , _f . disabled ) ;
0 commit comments