wlmaker
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
files.h File Reference
#include <libbase/libbase.h>
Include dependency graph for files.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _wlm_util_files_t wlm_util_files_t
 

Functions

wlm_util_files_twlm_util_files_create (const char *dirname_ptr)
 
void wlm_util_files_destroy (wlm_util_files_t *files_ptr)
 
char * wlm_util_files_xdg_config_fname (wlm_util_files_t *files_ptr, const char *fname_ptr)
 
char * wlm_util_files_xdg_config_find (wlm_util_files_t *files_ptr, const char *fname_ptr, int mode_type)
 
char * wlm_util_files_xdg_data_find (wlm_util_files_t *files_ptr, const char *fname_ptr, int mode_type)
 

Variables

const bs_test_set_t wlm_util_files_test_set
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Typedef Documentation

◆ wlm_util_files_t

Handle for files module.

Function Documentation

◆ wlm_util_files_create()

wlm_util_files_t * wlm_util_files_create ( const char *  dirname_ptr)

Create the files module.

Parameters
dirname_ptrName of a subdirectory, that will be used as a component for each of the XDG paths.
Returns
Pointer to the module handle. Must be freed by calling wlm_util_files_destroy.

◆ wlm_util_files_destroy()

void wlm_util_files_destroy ( wlm_util_files_t files_ptr)

Destroys the file module.

Parameters
files_ptr

◆ wlm_util_files_xdg_config_find()

char * wlm_util_files_xdg_config_find ( wlm_util_files_t files_ptr,
const char *  fname_ptr,
int  mode_type 
)

Finds a file (or directory, ...) from XDG configuration directories.

Joins wlm_util_files_t::dirname_ptr with fname_ptr, and then looks for that entity in ${XDG_CONFIG_HOME} and ${XDG_CONFIG_DIRS}. Returns true if the file has mode_type, eg. S_IFREG or S_ISDIR.

Returns
Full path name, or NULL on error. The caller must call free() to release the associated memory.

◆ wlm_util_files_xdg_config_fname()

char * wlm_util_files_xdg_config_fname ( wlm_util_files_t files_ptr,
const char *  fname_ptr 
)

Returns a full path name for a config file.

This expands into ${XDG_CONFIG_HOME}/*dirname_ptr/*fname_ptr.

Parameters
files_ptr
fname_ptr
Returns
Full path name, or NULL on error.

◆ wlm_util_files_xdg_data_find()

char * wlm_util_files_xdg_data_find ( wlm_util_files_t files_ptr,
const char *  fname_ptr,
int  mode_type 
)

Finds a file (or directory, ...) from XDG data directories.

Joins wlm_util_files_t::dirname_ptr with fname_ptr, and then looks for that entity in ${XDG_DATA_HOME} and ${XDG_DATA_DIRS}. Returns true if the file has mode_type, eg. S_IFREG or S_ISDIR.

Returns
Full path name, or NULL on error. The caller must call free() to release the associated memory.

Variable Documentation

◆ wlm_util_files_test_set

const bs_test_set_t wlm_util_files_test_set
extern

Unit test set for wlm_util_files_t.