@@ -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 ] ;
@@ -1369,14 +1370,15 @@ class ARMParser extends KeilParser<KeilARMOption> {
13691370 target . TargetOption . TargetCommonOption . Device = devName ;
13701371 target . TargetOption . TargetCommonOption . Vendor = vendor ;
13711372
1372- const outFolder = File . normalize ( prjConfig . config . outDir ) ;
1373- target . TargetOption . TargetCommonOption . OutputDirectory = `.\\${ outFolder } \\Keil\\` ;
1374- target . TargetOption . TargetCommonOption . ListingPath = `.\\${ outFolder } \\Keil\\` ;
1373+ const outFolderAbs = prj . ToAbsolutePath ( prjConfig . config . outDir ) ;
1374+ const outFolder = File . ToLocalPath ( keilOutputDir . ToRelativePath ( outFolderAbs ) || outFolderAbs ) ;
1375+ target . TargetOption . TargetCommonOption . OutputDirectory = `${ outFolder } \\Keil\\` ;
1376+ target . TargetOption . TargetCommonOption . ListingPath = `${ outFolder } \\Keil\\` ;
13751377 target . TargetOption . TargetCommonOption . OutputName = target . TargetName ;
13761378
13771379 target . TargetOption . TargetArmAds . Cads . VariousControls . IncludePath = mergedDep . incList
13781380 . map ( s => prj . resolveEnvVar ( s ) )
1379- . map ( inc => File . ToLocalPath ( prj . toRelativePath ( inc ) ) )
1381+ . map ( inc => { const abs = File . isAbsolute ( inc ) ? inc : prj . ToAbsolutePath ( inc ) ; return File . ToLocalPath ( keilOutputDir . ToRelativePath ( abs ) || abs ) ; } )
13801382 . join ( ';' ) ;
13811383
13821384 target . TargetOption . TargetArmAds . Cads . VariousControls . Define = mergedDep . defineList . join ( "," ) ; // C/CPP
@@ -1387,7 +1389,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
13871389 target . TargetOption . TargetArmAds . Aads . VariousControls . Define = defines . join ( "," ) ; // ASM
13881390 }
13891391
1390- this . setOption ( target . TargetOption , prj ) ;
1392+ this . setOption ( target . TargetOption , prj , keilOutputDir ) ;
13911393
13921394 const nGroups : any [ ] = [ ] ;
13931395
@@ -1404,7 +1406,7 @@ class ARMParser extends KeilParser<KeilARMOption> {
14041406 const fileElement = {
14051407 FileName : _f . file . name ,
14061408 FileType : this . getFileType ( _f . file ) . toString ( ) ,
1407- FilePath : prj . ToRelativePath ( _f . file . path ) || _f . file . path
1409+ FilePath : File . ToLocalPath ( keilOutputDir . ToRelativePath ( _f . file . path ) || _f . file . path )
14081410 } ;
14091411
14101412 this . setFileDisableFlag ( fileElement , _f . disabled ) ;
0 commit comments