1 /*
2 Copyright (C) 2015-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4filed.ctr
12 */
13 
14 #ifndef DK4FILED_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4FILED_H_INCLUDED 1
17 
18 
19 /**	@file
20 	File checks.
21 */
22 
23 #ifndef DK4CONF_H_INCLUDED
24 #if DK4_BUILDING_DKTOOLS4
25 #include "dk4conf.h"
26 #else
27 #include <dktools-4/dk4conf.h>
28 #endif
29 #endif
30 
31 #ifndef DK4TYPES_H_INCLUDED
32 #if DK4_BUILDING_DKTOOLS4
33 #include <libdk4base/dk4types.h>
34 #else
35 #include <dktools-4/dk4types.h>
36 #endif
37 #endif
38 
39 #ifndef DK4ERROR_H_INCLUDED
40 #if DK4_BUILDING_DKTOOLS4
41 #include <libdk4base/dk4error.h>
42 #else
43 #include <dktools-4/dk4error.h>
44 #endif
45 #endif
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /**	Check whether a path exists.
52 	CRT on Windows: Not used.
53 	@param	fn	File name.
54 	@param	erp	Error report, may be NULL.
55 	@return	1 if file exists, 0 otherwise.
56 	Note: The function also returns 0 if it fails to obtain information
57 	about a file, i.e. due to missing permissions...
58 
59 	Error codes:
60 	- DK4_E_NOT_SUPPORTED<br>
61 	  if wchar_t are used on non-Windows systems,
62 	- DK4_E_INVALID_ARGUMENTS<br>
63 	  if fn is NULL,
64 	- DK4_E_NOT_FOUND<br>
65 	  if the specified file was not found or retrieving information failed
66 	  for other reasons.
67 */
68 int
69 dk4file_exists(const dkChar *fn, dk4_er_t *erp);
70 
71 /**	Check whether a path name specifies a regular file.
72 	CRT on Windows: Not used.
73 	@param	fn	File name.
74 	@param	erp	Error report, may be NULL.
75 	@return	1 for existing regular file, 0 otherwise.
76 
77 	Error codes:
78 	DK4_E_NOT_SUPPORTED	if wchar_t are used on non-Windows systems,
79 	DK4_E_INVALID_ARGUMENTS	if fn is NULL,
80 	DK4_E_NOT_FOUND		if the file does not exist or retrieving
81 				the information failed for some reason,
82 	none			if the path exists but is not a regular file.
83 */
84 int
85 dk4file_is_regular(const dkChar *fn, dk4_er_t *erp);
86 
87 /**	Check whether a path name specifies a directory.
88 	CRT on Windows: Not used.
89 	@param	fn	File name.
90 	@param	erp	Error report, may be NULL.
91 	@return	1 for existing directory, 0 otherwise.
92 
93 	Error codes:
94 	- DK4_E_NOT_SUPPORTED<br>
95 	  on non-Windows systems,
96 	- DK4_E_INVALID_ARGUMENTS<br>
97 	  if fn is NULL,
98 	- DK4_E_NOT_FOUND<br>
99 	  if the file does not exist or retrieving the information failed
100 	  for some reason,
101 	- none<br>
102 	  if the path exists but is not a directory.
103 */
104 int
105 dk4file_is_directory(const dkChar *fn, dk4_er_t *erp);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 
112 #endif
113