GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/RenderBackend/backend_getFileName.cpp Lines: 9 10 90.0 %
Date: 2023-10-11 10:52:07 Branches: 20 26 76.9 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
8
9
10
#include "backend_getFileName.h"
11
12
13
///Returns a string and its prefix if the string is not empty
14
/**	@param str : input string
15
 * 	@param prefix : input prefix
16
 * 	@return prefix + str if str is not empty, empty string otherwise
17
*/
18
18
std::string backend_prefix(const std::string & str, const std::string & prefix){
19
18
	if(str != ""){
20
18
		return prefix + str;
21
	}else{
22
		return "";
23
	}
24
}
25
26
///Get the base name of a scene
27
/**	@param scene : Scene to be used
28
	@return base name of the files releated to the scene
29
*/
30
10
std::string backend_getSceneBaseFileName(const Scene & scene){
31


20
	return scene.getName() + backend_prefix(scene.getBlenderScene(), "_scene_") + eraseCharsInStr(scene.getOutputRenderDirectory(), " /'#\"");
32
}
33
34
///Get the name of the submit file of the given Scene
35
/**	@param scene : Scene to be used
36
 * 	@param extension : extension of the file
37
 * 	@param prefix : prefix of the filename
38
 * 	@return corresponding name of the submit file
39
*/
40
6
std::string backend_getFileName(const Scene & scene, const std::string & extension, const std::string & prefix){
41
12
	std::string submitDir(scene.getWorkingDirectory() + "/.condor");
42

6
	if(!createDirectoriesIfNotExist(submitDir)){return "";}
43

12
	return submitDir + "/" + prefix + backend_getSceneBaseFileName(scene) + "." + extension;
44
}
45
46