@@ -194,19 +194,20 @@ namespace Paths {
194194 return getArtifactsRootDir (projectContext) / " tests" ;
195195 }
196196 fs::path getMakefileDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
197- return getArtifactsRootDir (projectContext) / " make" / getRelativeDirPath (projectContext, sourceFilePath);
197+ // return getArtifactsRootDir(projectContext) / "make" / getRelativeDirPath(projectContext, sourceFilePath);
198+ return getGeneratedHeaderDir (projectContext, sourceFilePath);
198199 }
199200 fs::path getGeneratedHeaderDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
200201 return projectContext.testDirPath / getRelativeDirPath (projectContext, sourceFilePath);
201202 }
202203 fs::path getRecompiledDir (const utbot::ProjectContext &projectContext) {
203- return getTmpDir (projectContext. projectName ) / " recompiled" ;
204+ return getTmpDir (projectContext) / " recompiled" ;
204205 }
205206 fs::path getTestObjectDir (const utbot::ProjectContext &projectContext) {
206- return getTmpDir (projectContext. projectName ) / " test_objects" ;
207+ return getTmpDir (projectContext) / " test_objects" ;
207208 }
208209 fs::path getCoverageDir (const utbot::ProjectContext &projectContext) {
209- return getTmpDir (projectContext. projectName ) / " coverage" ;
210+ return getTmpDir (projectContext) / " coverage" ;
210211 }
211212 fs::path getClangCoverageDir (const utbot::ProjectContext &projectContext) {
212213 return getCoverageDir (projectContext) / " lcov" ;
@@ -249,15 +250,15 @@ namespace Paths {
249250
250251 fs::path getBuildFilePath (const utbot::ProjectContext &projectContext,
251252 const fs::path &sourceFilePath) {
252- fs::path path = getTmpDir (projectContext. projectName ) /
253+ fs::path path = getTmpDir (projectContext) /
253254 getRelativeDirPath (projectContext, sourceFilePath) /
254255 sourceFilePath.filename ();
255256 return addExtension (path, " .o" );
256257 }
257258
258259 fs::path getStubBuildFilePath (const utbot::ProjectContext &projectContext,
259260 const fs::path &sourceFilePath) {
260- fs::path path = getTmpDir (projectContext. projectName ) /
261+ fs::path path = getTmpDir (projectContext) /
261262 getRelativeDirPath (projectContext, sourceFilePath) /
262263 sourcePathToStubName (sourceFilePath);
263264 return addExtension (path, " .o" );
@@ -359,6 +360,18 @@ namespace Paths {
359360 return fs::relative (source.parent_path (), projectContext.projectPath );
360361 }
361362
363+ std::optional<std::string> getRelativePathWithShellVariable (const string &shellVariableForBase,
364+ const fs::path &base,
365+ const fs::path &source) {
366+
367+ auto relative = fs::relative (source, base).string ();
368+ if (relative.empty () || StringUtils::contains (relative, " .." )) {
369+ return std::nullopt ;
370+ }
371+ return std::make_optional (StringUtils::stringFormat (" %s/%s" , shellVariableForBase, fs::relative (source, base)));
372+ }
373+
374+
362375 fs::path stubPathToSourcePath (const utbot::ProjectContext &projectContext,
363376 const fs::path &stubPath) {
364377 fs::path sourceFilePath =
@@ -371,7 +384,13 @@ namespace Paths {
371384 return removeSuffix (srcPath, STUB_SUFFIX).stem () == headerPath.stem ();
372385 }
373386 fs::path getBuildDir (const utbot::ProjectContext &projectContext) {
374- return getTmpDir (projectContext.projectName ) / " build" ;
387+ return projectContext.buildDir ;
388+ }
389+
390+ fs::path getTmpDir (const utbot::ProjectContext &projectContext)
391+ {
392+ fs::path mountedCCJsonDirPath = getBuildDir (projectContext) / CompilationUtils::MOUNTED_CC_JSON_DIR_NAME;
393+ return mountedCCJsonDirPath / " tmp" / RequestEnvironment::getClientId ();
375394 }
376395
377396 // endregion
0 commit comments