%% options
copyright owner = Dirk Krause
copyright year = 2015-xxxx
license = bsd
%% header
/** @file
File name expander.
CRT on Windows: Optional.
*/
#ifndef DK4CONF_H_INCLUDED
#include "dk4conf.h"
#endif
#ifndef DK4DIR_H_INCLUDED
#include "dk4dir.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** Expand a file name.
@param pattern File name pattern, may optionally include
a directory part.
@param erp Error report, may be NULL.
@return Directory structure on success, NULL on error.
On success the path component in the returned directory structure
is NULL if the pattern did not contain a directory part.
Error codes:
- DK4_E_INVALID_ARGUMENTS
if path is NULL,
- DK4_E_NOT_SUPPORTED
if no function to traverse directories was found during build
process or the function is called on a non-Windows system,
- DK4_E_MEMORY_ALLOCATION_FAILED
if a memory allocation failed,
- DK4_E_MATH_OVERFLOW
if a mathematical overflow occured in a size calculation,
- DK4_E_BUFFER_TOO_SMALL
if one of the involved directory or file names is too long for an
internal buffer,
- DK4_E_OPENDIR_FAILED
with errno value in iDetails1 if the attempt to open the directory
failed,
- DK4_E_FINDFIRSTFILE_FAILED
with GetLastError() value in lDetails1 if the FindFirstFile()
function failed on Windows,
- DK4_E_SYSTEM
if the stat() or lstat() function failed for one of the directory
items.
*/
dk4_dir_t *
dk4fne_open(const dkChar *pattern, dk4_er_t *erp);
#ifdef __cplusplus
}
#endif
%% module
#include "dk4fne.h"
#if DK4_CHAR_SIZE > 1
#ifndef DK4FNEWC_H_INCLUDED
#include "dk4fnewc.h"
#endif
#else
#ifndef DK4FNE08_H_INCLUDED
#include "dk4fne08.h"
#endif
#endif
dk4_dir_t *
dk4fne_open(const dkChar *pattern, dk4_er_t *erp)
{
#if DK4_CHAR_SIZE > 1
return (dk4fne_open_wc(pattern, erp));
#else
return (dk4fne_open_c8(pattern, erp));
#endif
}