00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: apt_dir_layout.h 1524 2010-02-15 20:44:16Z achaloyan $ 00017 */ 00018 00019 #ifndef APT_DIR_LAYOUT_H 00020 #define APT_DIR_LAYOUT_H 00021 00022 /** 00023 * @file apt_dir_layout.h 00024 * @brief Directory Layout 00025 */ 00026 00027 #include "apt.h" 00028 00029 APT_BEGIN_EXTERN_C 00030 00031 /** Directory layout declaration */ 00032 typedef struct apt_dir_layout_t apt_dir_layout_t; 00033 00034 /** Directory layout */ 00035 struct apt_dir_layout_t { 00036 /** Path to config dir */ 00037 char *conf_dir_path; 00038 /** Path to plugin dir */ 00039 char *plugin_dir_path; 00040 /** Path to log dir */ 00041 char *log_dir_path; 00042 /** Path to data dir */ 00043 char *data_dir_path; 00044 }; 00045 00046 /** 00047 * Create (allocate) the structure of default directories layout. 00048 */ 00049 APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool); 00050 00051 /** 00052 * Create (allocate) the structure of custom directories layout. 00053 */ 00054 APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create( 00055 const char *conf_dir_path, 00056 const char *plugin_dir_path, 00057 const char *log_dir_path, 00058 const char *data_dir_path, 00059 apr_pool_t *pool); 00060 00061 /** Construct file path relative to data dir using the file name specified. */ 00062 APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); 00063 00064 /** Construct file path relative to conf dir using the file name specified. */ 00065 APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); 00066 00067 00068 APT_END_EXTERN_C 00069 00070 #endif /* APT_DIR_LAYOUT_H */