@@ -26,6 +26,7 @@ static apt_dir_layout_t* apt_dir_layout_alloc(apr_pool_t *pool)
26
26
dir_layout -> plugin_dir_path = NULL ;
27
27
dir_layout -> log_dir_path = NULL ;
28
28
dir_layout -> data_dir_path = NULL ;
29
+ dir_layout -> var_dir_path = NULL ;
29
30
return dir_layout ;
30
31
}
31
32
@@ -37,6 +38,7 @@ APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_di
37
38
apr_filepath_merge (& dir_layout -> plugin_dir_path ,root_dir_path ,"plugin" ,0 ,pool );
38
39
apr_filepath_merge (& dir_layout -> log_dir_path ,root_dir_path ,"log" ,0 ,pool );
39
40
apr_filepath_merge (& dir_layout -> data_dir_path ,root_dir_path ,"data" ,0 ,pool );
41
+ apr_filepath_merge (& dir_layout -> var_dir_path ,root_dir_path ,"var" ,0 ,pool );
40
42
}
41
43
return dir_layout ;
42
44
}
@@ -46,6 +48,7 @@ APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
46
48
const char * plugin_dir_path ,
47
49
const char * log_dir_path ,
48
50
const char * data_dir_path ,
51
+ const char * var_dir_path ,
49
52
apr_pool_t * pool )
50
53
{
51
54
apt_dir_layout_t * dir_layout = apt_dir_layout_alloc (pool );
@@ -61,9 +64,23 @@ APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
61
64
if (data_dir_path ) {
62
65
dir_layout -> data_dir_path = apr_pstrdup (pool ,data_dir_path );
63
66
}
67
+ if (var_dir_path ) {
68
+ dir_layout -> var_dir_path = apr_pstrdup (pool ,var_dir_path );
69
+ }
64
70
return dir_layout ;
65
71
}
66
72
73
+ APT_DECLARE (char * ) apt_confdir_filepath_get (const apt_dir_layout_t * dir_layout , const char * file_name , apr_pool_t * pool )
74
+ {
75
+ if (dir_layout && dir_layout -> conf_dir_path && file_name ) {
76
+ char * file_path = NULL ;
77
+ if (apr_filepath_merge (& file_path ,dir_layout -> conf_dir_path ,file_name ,0 ,pool ) == APR_SUCCESS ) {
78
+ return file_path ;
79
+ }
80
+ }
81
+ return NULL ;
82
+ }
83
+
67
84
APT_DECLARE (char * ) apt_datadir_filepath_get (const apt_dir_layout_t * dir_layout , const char * file_name , apr_pool_t * pool )
68
85
{
69
86
if (dir_layout && dir_layout -> data_dir_path && file_name ) {
@@ -75,11 +92,11 @@ APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout,
75
92
return NULL ;
76
93
}
77
94
78
- APT_DECLARE (char * ) apt_confdir_filepath_get (const apt_dir_layout_t * dir_layout , const char * file_name , apr_pool_t * pool )
95
+ APT_DECLARE (char * ) apt_vardir_filepath_get (const apt_dir_layout_t * dir_layout , const char * file_name , apr_pool_t * pool )
79
96
{
80
- if (dir_layout && dir_layout -> conf_dir_path && file_name ) {
97
+ if (dir_layout && dir_layout -> var_dir_path && file_name ) {
81
98
char * file_path = NULL ;
82
- if (apr_filepath_merge (& file_path ,dir_layout -> conf_dir_path ,file_name ,0 ,pool ) == APR_SUCCESS ) {
99
+ if (apr_filepath_merge (& file_path ,dir_layout -> var_dir_path ,file_name ,0 ,pool ) == APR_SUCCESS ) {
83
100
return file_path ;
84
101
}
85
102
}
0 commit comments