Zen API

- Home
- Help Topics
- Types by Category
- All Types
- Files

All Classes Files Functions Variables Typedefs Macros Groups Pages
kDirectory.h
Go to the documentation of this file.
1 /**
2 * @file kDirectory.h
3 * @brief Declares the kDirectory class.
4 *
5 * @internal
6 * Copyright (C) 2008-2014 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 #ifndef K_API_DIRECTORY_H
11 #define K_API_DIRECTORY_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17 /**
18 * @class kDirectory
19 * @ingroup kApi-Io
20 * @brief Collection of directory-related functions.
21 */
22 typedef kObject kDirectory;
23
24 /**
25 * Creates a directory at the specified location.
26 *
27 * This function will fail if the directory already exists. Missing parent folders will be created automatically.
28 *
29 * This function is only supported on Windows at this time.
30 *
31 * @public @memberof kDirectory
32 * @param directory Full path of the directory.
33 * @return Operation status.
34 */
35 kFx(kStatus) kDirectory_Create(const kChar* directory);
36
37 /**
38 * Reports whether the specified directory exists.
39 *
40 * This function is only supported on Windows at this time.
41 *
42 * @public @memberof kDirectory
43 * @param directory Full path of the directory.
44 * @return kTRUE if the directory exists, kFALSE otherwise.
45 */
46 kFx(kBool) kDirectory_Exists(const kChar* directory);
47
48 /**
49 * Copies the specified directory, including all of its contents.
50 *
51 * This function is only supported on Windows at this time.
52 *
53 * @public @memberof kDirectory
54 * @param source Full path of the source directory.
55 * @param destination Full path of the destination directory.
56 * @return Operation status.
57 */
58 kFx(kStatus) kDirectory_Copy(const kChar* source, const kChar* destination);
59
60 /**
61 * Moves the specified directory, including all of its contents.
62 *
63 * This function is only supported on Windows at this time.
64 *
65 * @public @memberof kDirectory
66 * @param source Full path of the source directory.
67 * @param destination Full path of the destination directory.
68 * @return Operation status.
69 */
70 kFx(kStatus) kDirectory_Move(const kChar* source, const kChar* destination);
71
72 /**
73 * Deletes the specified directory, including all of its contents.
74 *
75 * This function is only supported on Windows at this time.
76 *
77 * @public @memberof kDirectory
78 * @param directory Full path of the directory.
79 * @return Operation status.
80 */
81 kFx(kStatus) kDirectory_Delete(const kChar* directory);
82
83 /**
84 * List the files in the specified directory.
85 *
86 * Use kArrayList_Purge to destroy the file names returned by this function.
87 *
88 * @public @memberof kDirectory
89 * @param directory Full path of the directory.
90 * @param files Receives file names (kArrayList<kString>).
91 * @return Operation status.
92 */
93 kFx(kStatus) kDirectory_ListFiles(const kChar* directory, kArrayList files);
94
95 /**
96 * Creates a list of the sub-directories in the specified directory.
97 *
98 * Use kArrayList_Purge to destroy the directory names returned by this function.
99 *
100 * @public @memberof kDirectory
101 * @param directory Full path of the directory.
102 * @param directories Receives directory names (kArrayList<kString>).
103 * @return Operation status.
104 */
105 kFx(kStatus) kDirectory_ListDirectories(const kChar* directory, kArrayList directories);
106
107 /**
108 * Creates a list of the file system entries in the specified directory.
109 *
110 * Use kArrayList_Purge to destroy the entry names returned by this function.
111 *
112 * @public @memberof kDirectory
113 * @param directory Full path of the directory.
114 * @param entries Receives entry names (kArrayList<kString>).
115 * @return Operation status.
116 */
117 kFx(kStatus) kDirectory_ListEntries(const kChar* directory, kArrayList entries);
118
119 /**
120 * Sets the current working directory.
121 *
122 * @public @memberof kDirectory
123 * @param directory Full path of the desired working directory.
124 * @return Operation status.
125 */
126 kFx(kStatus) kDirectory_SetCurrent(const kChar* directory);
127
128 /**
129 * Gets the current working directory.
130 *
131 * @public @memberof kDirectory
132 * @param directory Returns the full path of the current working directory.
133 * @param capacity Maximum number of characters (including null terminator).
134 * @return Operation status.
135 */
136 kFx(kStatus) kDirectory_Current(kChar* directory, kSize capacity);
137
138 /**
139 * Gets the directory in which the application executable file resides.
140 *
141 * @public @memberof kDirectory
142 * @param directory Returns the full path of the application directory.
143 * @param capacity Maximum number of characters (including null terminator).
144 * @return Operation status.
145 */
146 kFx(kStatus) kDirectory_Application(kChar* directory, kSize capacity);
147
148 /**
149 * Gets the path of a directory suitable for temporary files.
150 *
151 * @public @memberof kDirectory
152 * @param directory Returns the full path of the temp directory.
153 * @param capacity Maximum number of characters (including null terminator).
154 * @return Operation status.
155 */
156 kFx(kStatus) kDirectory_Temp(kChar* directory, kSize capacity);
157
158 /**
159 * Gets the directory from which an application should load its configuration/resource files.
160 *
161 * This function assumes the standard folder organization of a kApi-based application.
162 *
163 * @public @memberof kDirectory
164 * @param appName The name of the application (optional).
165 * @param directory Returns the full path of the requested directory.
166 * @param capacity Maximum number of characters (including null terminator).
167 * @return Operation status.
168 */
169 kFx(kStatus) kDirectory_AppConfig(const kChar* appName, kChar* directory, kSize capacity);
170
171 /**
172 * Gets a directory suitable for an application to write data files.
173 *
174 * This function assumes the standard folder organization of a kApi-based application.
175 *
176 * @public @memberof kDirectory
177 * @param appName The name of the application (optional).
178 * @param directory Returns the full path of the requested directory.
179 * @param capacity Maximum number of characters (including null terminator).
180 * @return Operation status.
181 */
182 kFx(kStatus) kDirectory_AppData(const kChar* appName, kChar* directory, kSize capacity);
183
184 /**
185 * Gets the directory where plug-ins are located.
186 *
187 * This function assumes the standard folder organization of a kApi-based application.
188 *
189 * @public @memberof kDirectory
190 * @param directory Returns the full path of the requested directory.
191 * @param capacity Maximum number of characters (including null terminator).
192 * @return Operation status.
193 */
194 kFx(kStatus) kDirectory_Plugin(kChar* directory, kSize capacity);
195
196 kEndHeader()
197
198 #include <kApi/Io/kDirectory.x.h>
199
200 #endif
kDirectory::kDirectory_Move
kStatus kDirectory_Move(const kChar *source, const kChar *destination)
Moves the specified directory, including all of its contents.
kDirectory::kDirectory_ListDirectories
kStatus kDirectory_ListDirectories(const kChar *directory, kArrayList directories)
Creates a list of the sub-directories in the specified directory.
kDirectory::kDirectory_Plugin
kStatus kDirectory_Plugin(kChar *directory, kSize capacity)
Gets the directory where plug-ins are located.
kDirectory::kDirectory_SetCurrent
kStatus kDirectory_SetCurrent(const kChar *directory)
Sets the current working directory.
kDirectory
Collection of directory-related functions.
kDirectory::kDirectory_Copy
kStatus kDirectory_Copy(const kChar *source, const kChar *destination)
Copies the specified directory, including all of its contents.
kDirectory::kDirectory_Current
kStatus kDirectory_Current(kChar *directory, kSize capacity)
Gets the current working directory.
kSize
Represents an unsigned integer that can store a pointer address.
kDirectory::kDirectory_Delete
kStatus kDirectory_Delete(const kChar *directory)
Deletes the specified directory, including all of its contents.
kDirectory::kDirectory_ListEntries
kStatus kDirectory_ListEntries(const kChar *directory, kArrayList entries)
Creates a list of the file system entries in the specified directory.
kChar
Represents a single unit (byte) in a UTF-8 character.
kDirectory::kDirectory_Exists
kBool kDirectory_Exists(const kChar *directory)
Reports whether the specified directory exists.
kDirectory::kDirectory_Create
kStatus kDirectory_Create(const kChar *directory)
Creates a directory at the specified location.
kDirectory::kDirectory_AppData
kStatus kDirectory_AppData(const kChar *appName, kChar *directory, kSize capacity)
Gets a directory suitable for an application to write data files.
kDirectory::kDirectory_ListFiles
kStatus kDirectory_ListFiles(const kChar *directory, kArrayList files)
List the files in the specified directory.
kDirectory::kDirectory_AppConfig
kStatus kDirectory_AppConfig(const kChar *appName, kChar *directory, kSize capacity)
Gets the directory from which an application should load its configuration/resource files...
kApiDef.h
Essential API declarations.
kDirectory::kDirectory_Temp
kStatus kDirectory_Temp(kChar *directory, kSize capacity)
Gets the path of a directory suitable for temporary files.
kArrayList
Represents a list implemented with a dynamic array.
kDirectory::kDirectory_Application
kStatus kDirectory_Application(kChar *directory, kSize capacity)
Gets the directory in which the application executable file resides.
kObject
Root of all class types in the Zen type system.
kStatus
Represents an enumeration of error codes.
kBool
Represents a boolean value.