Branch data Line data Source code
1 : : #include "precizer.h"
2 : :
3 : : /**
4 : : *
5 : : * Check all paths passed as arguments.
6 : : * Are they directories and do they exist?
7 : : *
8 : : */
9 : :
10 : 325 : Return paths_detect(void)
11 : : {
12 : : /* Status returned by this function through provide()
13 : : Default value assumes successful completion */
14 : 325 : Return status = SUCCESS;
15 : :
16 : : // Don't do anything
17 [ + + ]: 325 : if(config->compare == true)
18 : : {
19 : : // The option to compare databases has been selected.
20 : : // There is no need to compare paths
21 : 76 : slog(TRACE,"Comparing databases. Directory path verification is not required\n");
22 : 76 : provide(status);
23 : : } else {
24 : : // Check directory paths passed as arguments, traverse
25 : : // them for files, and store the file metadata in the database
26 : 249 : slog(TRACE,"Checking directory paths provided as arguments\n");
27 : : }
28 : :
29 [ - + ]: 249 : if(config->paths == NULL)
30 : : {
31 : 0 : slog(ERROR,"The PATH is not defined\n");
32 : 0 : status = FAILURE;
33 : : }
34 : :
35 [ + + ]: 498 : for(int i = 0; config->paths[i]; i++)
36 : : {
37 [ + - - + ]: 249 : if(SUCCESS == status && NOT_FOUND == file_availability(config->paths[i],SHOULD_BE_A_DIRECTORY))
38 : : {
39 : 0 : status = FAILURE;
40 : : }
41 : : }
42 : :
43 : 249 : slog(TRACE,"Path detection is finished\n");
44 : :
45 : 249 : provide(status);
46 : : }
|