-
Notifications
You must be signed in to change notification settings - Fork 2
/
db_isFrameworkStructureSane.m
54 lines (48 loc) · 1.64 KB
/
db_isFrameworkStructureSane.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function [ sanity ] = db_isFrameworkStructureSane()
%isFrameworkStructureSane Checks the sanity of basic framework structure
% Detailed explanation goes here
%% Set initial output vars
sanity = true;
%% Load dbConfig
dbConfigFile = db_getDbConfigFileURI();
if exist(dbConfigFile, 'file') ~= 2
db_generateConfig();
end
load(dbConfigFile);
%% Start sanity check
if exist(dbFrameworkRootDir, 'dir') ~= 7
sanity = false; return;
end
if exist(videoDbDir, 'dir') ~= 7
sanity = false; return;
end
if exist(tmpDir, 'dir') ~= 7
sanity = false; return;
end
if exist(indexDir, 'dir') ~= 7
sanity = false; return;
end
if exist(videoDbRecordFile, 'file') ~= 2
sanity = false; return;
end
if exist(videoDbCountFile, 'file') ~= 2
sanity = false; return;
end
% check existence for all index category directories with index files
numCategories = length(indexCategories);
for i = 1 : numCategories
% check directory existence for this index category
thisCategoryDir = strcat(indexDir, indexCategories{i}, pathSeparator);
if exist(thisCategoryDir, 'dir') ~= 7
sanity = false; return;
end
% check existence for index files for this index category
thisCategoryClasses = eval(strcat(indexCategories{i}, classVariableExtension));
numClasses = length(thisCategoryClasses);
for j = 1 : numClasses
if exist(strcat(thisCategoryDir, thisCategoryClasses{j}, indexFileExtension), 'file') ~= 2
sanity = false; return;
end
end
end
end