@@ -3493,39 +3493,46 @@ bool ProjMgrWorker::ProcessSequencesRelatives(ContextItem & context, bool rerun)
34933493 return true ;
34943494}
34953495
3496- void ProjMgrWorker::ExpandAccessSequence (const ContextItem& context, const ContextItem& refContext, const string& sequence, const string& outdir, string& item, bool withHeadingDot) {
3497- const string refContextOutDir = refContext. directories . cprj + " / " + refContext.directories .outdir ;
3498- const string relOutDir = outdir. empty () ? refContextOutDir : RteFsUtils::RelativePath (refContextOutDir, outdir, withHeadingDot );
3496+ void ProjMgrWorker::ExpandAccessSequence (ContextItem& context, const ContextItem& refContext, const string& sequence, const string& outdir, string& item, bool withHeadingDot) {
3497+ string refContextOutDir = refContext.directories .outdir ;
3498+ RteFsUtils::NormalizePath (refContextOutDir, refContext. directories . cprj );
34993499 string regExStr = " \\ $" ;
35003500 string replacement;
35013501 if (sequence == RteConstants::AS_SOLUTION_DIR) {
35023502 regExStr += RteConstants::AS_SOLUTION_DIR;
3503- replacement = outdir. empty () ? refContext.csolution ->directory : RteFsUtils::RelativePath (refContext. csolution -> directory , outdir, withHeadingDot) ;
3503+ replacement = refContext.csolution ->directory ;
35043504 } else if (sequence == RteConstants::AS_PROJECT_DIR) {
35053505 regExStr += RteConstants::AS_PROJECT_DIR;
3506- replacement = outdir. empty () ? refContext.cproject ->directory : RteFsUtils::RelativePath (refContext. cproject -> directory , outdir, withHeadingDot) ;
3506+ replacement = refContext.cproject ->directory ;
35073507 } else if (sequence == RteConstants::AS_OUT_DIR) {
35083508 regExStr += RteConstants::AS_OUT_DIR;
3509- replacement = relOutDir ;
3509+ replacement = refContextOutDir ;
35103510 } else if (sequence == RteConstants::AS_ELF) {
35113511 regExStr += RteConstants::AS_ELF;
3512- replacement = refContext.outputTypes .elf .on ? relOutDir + " /" + refContext.outputTypes .elf .filename : " " ;
3512+ replacement = refContext.outputTypes .elf .on ? refContextOutDir + " /" + refContext.outputTypes .elf .filename : " " ;
35133513 } else if (sequence == RteConstants::AS_BIN) {
35143514 regExStr += RteConstants::AS_BIN;
3515- replacement = refContext.outputTypes .bin .on ? relOutDir + " /" + refContext.outputTypes .bin .filename : " " ;
3515+ replacement = refContext.outputTypes .bin .on ? refContextOutDir + " /" + refContext.outputTypes .bin .filename : " " ;
35163516 } else if (sequence == RteConstants::AS_HEX) {
35173517 regExStr += RteConstants::AS_HEX;
3518- replacement = refContext.outputTypes .hex .on ? relOutDir + " /" + refContext.outputTypes .hex .filename : " " ;
3518+ replacement = refContext.outputTypes .hex .on ? refContextOutDir + " /" + refContext.outputTypes .hex .filename : " " ;
35193519 } else if (sequence == RteConstants::AS_LIB) {
35203520 regExStr += RteConstants::AS_LIB;
3521- replacement = refContext.outputTypes .lib .on ? relOutDir + " /" + refContext.outputTypes .lib .filename : " " ;
3521+ replacement = refContext.outputTypes .lib .on ? refContextOutDir + " /" + refContext.outputTypes .lib .filename : " " ;
35223522 } else if (sequence == RteConstants::AS_CMSE) {
35233523 regExStr += RteConstants::AS_CMSE;
3524- replacement = refContext.outputTypes .cmse .on ? relOutDir + " /" + refContext.outputTypes .cmse .filename : " " ;
3524+ replacement = refContext.outputTypes .cmse .on ? refContextOutDir + " /" + refContext.outputTypes .cmse .filename : " " ;
35253525 } else if (sequence == RteConstants::AS_MAP) {
35263526 regExStr += RteConstants::AS_MAP;
3527- replacement = refContext.outputTypes .map .on ? relOutDir + " /" + refContext.outputTypes .map .filename : " " ;
3527+ replacement = refContext.outputTypes .map .on ? refContextOutDir + " /" + refContext.outputTypes .map .filename : " " ;
35283528 }
3529+ // store sequence and its evaluated absolute path
3530+ context.absPathSequences [item.substr (1 , item.size () - 2 )] = replacement;
3531+ // get relative path
3532+ if (!replacement.empty () && !outdir.empty ()) {
3533+ replacement = RteFsUtils::RelativePath (replacement, outdir, withHeadingDot);
3534+ }
3535+ // replace sequence
35293536 regex regEx = regex (regExStr + " \\ (.*\\ )\\ $" );
35303537 item = regex_replace (item, regEx, replacement);
35313538}
0 commit comments