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 202 : Return detect_paths(void)
11 : {
12 : /// The status that will be passed to return() before exiting.
13 : /// By default, the function worked without errors.
14 202 : Return status = SUCCESS;
15 :
16 : // Don't do anything
17 202 : if(config->compare == true)
18 : {
19 : // The option to compare databases has been selected.
20 : // There is no need to compare paths
21 36 : slog(TRACE,"Comparing databases. Directory path verification is not required\n");
22 36 : 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 166 : slog(TRACE,"Checking directory paths provided as arguments\n");
27 : }
28 :
29 332 : for(int i = 0; config->paths[i]; i++)
30 : {
31 166 : if(SUCCESS == status && NOT_FOUND == file_availability(config->paths[i],SHOULD_BE_A_DIRECTORY))
32 : {
33 0 : status = FAILURE;
34 : }
35 : }
36 :
37 166 : slog(TRACE,"Paths detected\n");
38 :
39 166 : provide(status);
40 : }
|