@@ -352,6 +352,13 @@ runcpp2::CheckSourcesNeedUpdate( const std::string& scriptPath,
352352
353353 // Initialize BuildsManager and IncludeManager
354354 ghc::filesystem::path configDir = GetConfigFilePath ();
355+ configDir = configDir.parent_path ();
356+ if (!ghc::filesystem::is_directory (configDir, e))
357+ {
358+ ssLOG_FATAL (" Unexpected path for config directory: " << configDir.string ());
359+ return PipelineResult::INVALID_CONFIG_PATH;
360+ }
361+
355362 ghc::filesystem::path buildDir;
356363 BuildsManager buildsManager (" /tmp" );
357364 IncludeManager includeManager;
@@ -581,27 +588,7 @@ runcpp2::StartPipeline( const std::string& scriptPath,
581588 ghc::filesystem::file_time_type finalObjectWriteTime;
582589
583590 if (currentOptions.count (runcpp2::CmdOptions::RESET_CACHE) > 0 || recompileNeeded)
584- {
585591 sourceHasCache = std::vector<bool >(sourceFiles.size (), false );
586-
587- // Update the include records
588- {
589- runcpp2::SourceIncludeMap sourcesIncludes;
590- if (!runcpp2::GatherFilesIncludes (sourceFiles, includePaths, sourcesIncludes))
591- return PipelineResult::UNEXPECTED_FAILURE;
592-
593- for (auto it = sourcesIncludes.cbegin (); it != sourcesIncludes.cend (); ++it)
594- {
595- ssLOG_DEBUG (" Updating include record for " << it->first );
596- if (!includeManager.WriteIncludeRecord ( ghc::filesystem::path (it->first ),
597- it->second ))
598- {
599- ssLOG_ERROR (" Failed to write include record for " << it->first );
600- return PipelineResult::UNEXPECTED_FAILURE;
601- }
602- }
603- }
604- }
605592 else if (!HasCompiledCache ( absoluteScriptPath,
606593 sourceFiles,
607594 buildDir,
@@ -616,6 +603,34 @@ runcpp2::StartPipeline( const std::string& scriptPath,
616603 return PipelineResult::UNEXPECTED_FAILURE;
617604 }
618605
606+ // Update the include records
607+ {
608+ runcpp2::SourceIncludeMap sourcesIncludes;
609+ if (!runcpp2::GatherFilesIncludes (sourceFiles, includePaths, sourcesIncludes))
610+ return PipelineResult::UNEXPECTED_FAILURE;
611+
612+ for (int i = 0 ; i < sourceFiles.size (); ++i)
613+ {
614+ ssLOG_DEBUG (" Updating include record for " << sourceFiles.at (i).string ());
615+ if (!sourceHasCache.at (i))
616+ {
617+ if (sourcesIncludes.count (sourceFiles.at (i)) == 0 )
618+ {
619+ ssLOG_WARNING (" Includes not gathered for " << sourceFiles.at (i).string ());
620+ continue ;
621+ }
622+
623+ if (!includeManager.WriteIncludeRecord ( sourceFiles.at (i),
624+ sourcesIncludes.at (sourceFiles.at (i))))
625+ {
626+ ssLOG_ERROR (" Failed to write include record for " <<
627+ sourceFiles.at (i).string ());
628+ return PipelineResult::UNEXPECTED_FAILURE;
629+ }
630+ }
631+ }
632+ }
633+
619634 std::vector<std::string> linkFilesPaths;
620635 SeparateDependencyFiles (profiles.at (profileIndex).FilesTypes ,
621636 gatheredBinariesPaths,
0 commit comments