]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
55034339 | 2 | // Name: wx/filefn.h |
c801d85f KB |
3 | // Purpose: File- and directory-related functions |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 29/01/98 | |
c801d85f | 7 | // Copyright: (c) 1998 Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
34138703 JS |
11 | #ifndef _FILEFN_H_ |
12 | #define _FILEFN_H_ | |
c801d85f | 13 | |
ed58dbea | 14 | #include "wx/list.h" |
b76069e2 | 15 | #include "wx/arrstr.h" |
e49f47aa | 16 | |
6294ac2e VZ |
17 | #ifdef __WXWINCE__ |
18 | #include "wx/msw/wince/time.h" | |
19 | #include "wx/msw/private.h" | |
20 | #else | |
21 | #include <time.h> | |
0e0126c2 | 22 | #endif |
a47ce4a7 | 23 | |
2415cf67 | 24 | #ifndef __WXWINCE__ |
6294ac2e VZ |
25 | #include <sys/types.h> |
26 | #include <sys/stat.h> | |
6294ac2e VZ |
27 | #endif |
28 | ||
29 | #ifdef __OS2__ | |
30 | // need to check for __OS2__ first since currently both | |
31 | // __OS2__ and __UNIX__ are defined. | |
32 | #include <process.h> | |
33 | #include "wx/os2/private.h" | |
0872eaf9 WS |
34 | #ifdef __WATCOMC__ |
35 | #include <direct.h> | |
36 | #endif | |
6294ac2e VZ |
37 | #include <io.h> |
38 | #ifdef __EMX__ | |
39 | #include <unistd.h> | |
40 | #endif | |
41 | #elif defined(__UNIX__) | |
42 | #include <unistd.h> | |
43 | #include <dirent.h> | |
44 | #endif | |
45 | ||
46 | #if defined(__WINDOWS__) && !defined(__WXMICROWIN__) | |
2415cf67 | 47 | #if !defined( __GNUWIN32__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__) |
6294ac2e VZ |
48 | #include <direct.h> |
49 | #include <dos.h> | |
50 | #include <io.h> | |
51 | #endif // __WINDOWS__ | |
52 | #endif // native Win compiler | |
53 | ||
54 | #if defined(__DOS__) | |
55 | #ifdef __WATCOMC__ | |
56 | #include <direct.h> | |
57 | #include <dos.h> | |
58 | #include <io.h> | |
59 | #endif | |
60 | #ifdef __DJGPP__ | |
61 | #include <io.h> | |
62 | #include <unistd.h> | |
63 | #endif | |
64 | #endif | |
65 | ||
66 | #ifdef __BORLANDC__ // Please someone tell me which version of Borland needs | |
67 | // this (3.1 I believe) and how to test for it. | |
68 | // If this works for Borland 4.0 as well, then no worries. | |
69 | #include <dir.h> | |
70 | #endif | |
71 | ||
6294ac2e VZ |
72 | #ifndef __WXWINCE__ |
73 | #include <fcntl.h> // O_RDONLY &c | |
74 | #endif | |
bd362275 | 75 | |
45ea509a VZ |
76 | // ---------------------------------------------------------------------------- |
77 | // constants | |
78 | // ---------------------------------------------------------------------------- | |
c801d85f | 79 | |
f54debba | 80 | #if defined(__VISUALC__) || defined(__INTELC__) || defined(__DIGITALMARS__) |
52de37c7 VS |
81 | typedef int mode_t; |
82 | #endif | |
83 | ||
0e0126c2 RR |
84 | #ifdef __WXWINCE__ |
85 | typedef long off_t; | |
86 | #else | |
6294ac2e VZ |
87 | // define off_t |
88 | #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__) | |
89 | #include <sys/types.h> | |
90 | #else | |
91 | typedef long off_t; | |
92 | #endif | |
17dff81c | 93 | #endif |
45ea509a | 94 | |
2415cf67 | 95 | #if defined(__VISUALC__) && !defined(__WXWINCE__) |
3f4a0c5b | 96 | typedef _off_t off_t; |
2bdf7154 | 97 | #elif defined(__SYMANTEC__) |
3f4a0c5b | 98 | typedef long off_t; |
2432b92d JS |
99 | #endif |
100 | ||
7af89395 VZ |
101 | enum wxSeekMode |
102 | { | |
45ea509a VZ |
103 | wxFromStart, |
104 | wxFromCurrent, | |
105 | wxFromEnd | |
7af89395 | 106 | }; |
45ea509a | 107 | |
0912690b | 108 | enum wxFileKind |
3c70014d | 109 | { |
0912690b MW |
110 | wxFILE_KIND_UNKNOWN, |
111 | wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets | |
112 | wxFILE_KIND_TERMINAL, // a tty | |
113 | wxFILE_KIND_PIPE // a pipe | |
3c70014d MW |
114 | }; |
115 | ||
9508a23a VZ |
116 | // we redefine these constants here because S_IREAD &c are _not_ standard |
117 | // however, we do assume that the values correspond to the Unix umask bits | |
118 | enum wxPosixPermissions | |
119 | { | |
120 | // standard Posix names for these permission flags: | |
121 | wxS_IRUSR = 00400, | |
122 | wxS_IWUSR = 00200, | |
123 | wxS_IXUSR = 00100, | |
124 | ||
125 | wxS_IRGRP = 00040, | |
126 | wxS_IWGRP = 00020, | |
127 | wxS_IXGRP = 00010, | |
128 | ||
129 | wxS_IROTH = 00004, | |
130 | wxS_IWOTH = 00002, | |
131 | wxS_IXOTH = 00001, | |
132 | ||
133 | // longer but more readable synonyms for the constants above: | |
134 | wxPOSIX_USER_READ = wxS_IRUSR, | |
135 | wxPOSIX_USER_WRITE = wxS_IWUSR, | |
136 | wxPOSIX_USER_EXECUTE = wxS_IXUSR, | |
137 | ||
138 | wxPOSIX_GROUP_READ = wxS_IRGRP, | |
139 | wxPOSIX_GROUP_WRITE = wxS_IWGRP, | |
140 | wxPOSIX_GROUP_EXECUTE = wxS_IXGRP, | |
141 | ||
142 | wxPOSIX_OTHERS_READ = wxS_IROTH, | |
143 | wxPOSIX_OTHERS_WRITE = wxS_IWOTH, | |
144 | wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH, | |
145 | ||
146 | // default mode for the new files: allow reading/writing them to everybody but | |
147 | // the effective file mode will be set after anding this value with umask and | |
148 | // so won't include wxS_IW{GRP,OTH} for the default 022 umask value | |
149 | wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \ | |
150 | wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \ | |
151 | wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE), | |
152 | ||
153 | // default mode for the new directories (see wxFileName::Mkdir): allow | |
154 | // reading/writing/executing them to everybody, but just like wxS_DEFAULT | |
155 | // the effective directory mode will be set after anding this value with umask | |
156 | wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \ | |
157 | wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \ | |
158 | wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE) | |
159 | }; | |
160 | ||
f6bcfd97 BP |
161 | // ---------------------------------------------------------------------------- |
162 | // declare our versions of low level file functions: some compilers prepend | |
163 | // underscores to the usual names, some also have Unicode versions of them | |
164 | // ---------------------------------------------------------------------------- | |
165 | ||
6294ac2e VZ |
166 | // Wrappers around Win32 api functions like CreateFile, ReadFile and such |
167 | // Implemented in filefnwce.cpp | |
08c63240 | 168 | #if defined( __WXWINCE__) |
6294ac2e | 169 | typedef __int64 wxFileOffset; |
16c15822 | 170 | #define wxFileOffsetFmtSpec wxT("I64") |
52de37c7 VS |
171 | WXDLLIMPEXP_BASE int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)); |
172 | WXDLLIMPEXP_BASE int wxCRT_Access(const wxChar *name, int WXUNUSED(how)); | |
5bd6ad08 | 173 | WXDLLIMPEXP_BASE int wxCRT_Chmod(const wxChar *name, int WXUNUSED(how)); |
aec1621e VS |
174 | WXDLLIMPEXP_BASE int wxClose(int fd); |
175 | WXDLLIMPEXP_BASE int wxFsync(int WXUNUSED(fd)); | |
176 | WXDLLIMPEXP_BASE int wxRead(int fd, void *buf, unsigned int count); | |
177 | WXDLLIMPEXP_BASE int wxWrite(int fd, const void *buf, unsigned int count); | |
178 | WXDLLIMPEXP_BASE int wxEof(int fd); | |
179 | WXDLLIMPEXP_BASE wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); | |
6294ac2e | 180 | #define wxLSeek wxSeek |
aec1621e | 181 | WXDLLIMPEXP_BASE wxFileOffset wxTell(int fd); |
27b2dd53 | 182 | |
c34db1be | 183 | // always Unicode under WinCE |
52de37c7 VS |
184 | #define wxCRT_MkDir _wmkdir |
185 | #define wxCRT_RmDir _wrmdir | |
186 | #define wxCRT_Stat _wstat | |
6294ac2e | 187 | #define wxStructStat struct _stat |
d98a58c5 | 188 | #elif (defined(__WINDOWS__) || defined(__OS2__)) && \ |
dedcebb9 VZ |
189 | ( \ |
190 | defined(__VISUALC__) || \ | |
98225d02 | 191 | defined(__MINGW64__) || \ |
dedcebb9 VZ |
192 | (defined(__MINGW32__) && !defined(__WINE__) && \ |
193 | wxCHECK_W32API_VERSION(0, 5)) || \ | |
dedcebb9 VZ |
194 | defined(__DMC__) || \ |
195 | defined(__WATCOMC__) || \ | |
196 | defined(__BORLANDC__) \ | |
197 | ) | |
4004775e | 198 | |
224d978f | 199 | // temporary defines just used immediately below |
4ae9be50 | 200 | #undef wxHAS_HUGE_FILES |
224d978f | 201 | #undef wxHAS_HUGE_STDIO_FILES |
dedcebb9 | 202 | |
76c36512 VZ |
203 | // detect compilers which have support for huge files |
204 | #if defined(__VISUALC__) | |
c26d982b | 205 | #define wxHAS_HUGE_FILES 1 |
98225d02 | 206 | #elif defined(__MINGW32__) || defined(__MINGW64__) |
4ae9be50 | 207 | #define wxHAS_HUGE_FILES 1 |
1ad688c9 VZ |
208 | #elif defined(_LARGE_FILES) |
209 | #define wxHAS_HUGE_FILES 1 | |
6294ac2e VZ |
210 | #endif |
211 | ||
224d978f MW |
212 | // detect compilers which have support for huge stdio files |
213 | #if wxCHECK_VISUALC_VERSION(8) | |
214 | #define wxHAS_HUGE_STDIO_FILES | |
215 | #define wxFseek _fseeki64 | |
216 | #define wxFtell _ftelli64 | |
61a69259 MW |
217 | #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc) |
218 | #define wxHAS_HUGE_STDIO_FILES | |
219 | #define wxFseek fseeko64 | |
220 | #define wxFtell ftello64 | |
224d978f MW |
221 | #endif |
222 | ||
2415cf67 VZ |
223 | // other Windows compilers (DMC, Watcom, and Borland) don't have huge file |
224 | // support (or at least not all functions needed for it by wx) currently | |
1ad688c9 | 225 | |
4bf3e3a7 VZ |
226 | // types |
227 | ||
1ad688c9 | 228 | #ifdef wxHAS_HUGE_FILES |
6294ac2e VZ |
229 | typedef wxLongLong_t wxFileOffset; |
230 | #define wxFileOffsetFmtSpec wxLongLongFmtSpec | |
231 | #else | |
4004775e | 232 | typedef off_t wxFileOffset; |
6294ac2e VZ |
233 | #endif |
234 | ||
4bf3e3a7 VZ |
235 | // at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope |
236 | // resolution operator present in wxPOSIX_IDENT for it | |
237 | #ifdef __BORLANDC__ | |
238 | #define wxPOSIX_STRUCT(s) struct s | |
239 | #else | |
240 | #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) | |
241 | #endif | |
242 | ||
243 | // Notice that Watcom is the only compiler to have a wide char | |
244 | // version of struct stat as well as a wide char stat function variant. | |
245 | // This was dropped since OW 1.4 "for consistency across platforms". | |
246 | // | |
247 | // Borland is also special in that it uses _stat with Unicode functions | |
248 | // (for MSVC compatibility?) but stat with ANSI ones | |
249 | #ifdef __BORLANDC__ | |
250 | #if wxHAS_HUGE_FILES | |
251 | #define wxStructStat struct stati64 | |
252 | #else | |
253 | #if wxUSE_UNICODE | |
254 | #define wxStructStat struct _stat | |
255 | #else | |
256 | #define wxStructStat struct stat | |
257 | #endif | |
258 | #endif | |
259 | #else // !__BORLANDC__ | |
260 | #ifdef wxHAS_HUGE_FILES | |
261 | #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) | |
262 | #define wxStructStat struct _wstati64 | |
263 | #else | |
264 | #define wxStructStat struct _stati64 | |
265 | #endif | |
266 | #else | |
267 | #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) | |
268 | #define wxStructStat struct _wstat | |
269 | #else | |
270 | #define wxStructStat struct _stat | |
271 | #endif | |
272 | #endif | |
273 | #endif // __BORLANDC__/!__BORLANDC__ | |
274 | ||
f49ad976 VZ |
275 | |
276 | // functions | |
277 | ||
278 | // MSVC and compatible compilers prepend underscores to the POSIX function | |
279 | // names, other compilers don't and even if their later versions usually do | |
280 | // define the versions with underscores for MSVC compatibility, it's better | |
281 | // to avoid using them as they're not present in earlier versions and | |
282 | // always using the native functions spelling is easier than testing for | |
283 | // the versions | |
3656eefc | 284 | #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) |
f49ad976 VZ |
285 | #define wxPOSIX_IDENT(func) ::func |
286 | #else // by default assume MSVC-compatible names | |
287 | #define wxPOSIX_IDENT(func) _ ## func | |
288 | #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS | |
289 | #endif | |
290 | ||
f49ad976 VZ |
291 | // first functions not working with strings, i.e. without ANSI/Unicode |
292 | // complications | |
293 | #define wxClose wxPOSIX_IDENT(close) | |
6294ac2e | 294 | |
2415cf67 VZ |
295 | #define wxRead wxPOSIX_IDENT(read) |
296 | #define wxWrite wxPOSIX_IDENT(write) | |
f49ad976 | 297 | |
1ad688c9 | 298 | #ifdef wxHAS_HUGE_FILES |
3656eefc SN |
299 | #ifndef __MINGW64__ |
300 | #define wxSeek wxPOSIX_IDENT(lseeki64) | |
301 | #define wxLseek wxPOSIX_IDENT(lseeki64) | |
302 | #define wxTell wxPOSIX_IDENT(telli64) | |
303 | #else | |
304 | // unfortunately, mingw-W64 is somewhat inconsistent... | |
305 | #define wxSeek _lseeki64 | |
306 | #define wxLseek _lseeki64 | |
307 | #define wxTell _telli64 | |
308 | #endif | |
dedcebb9 | 309 | #else // !wxHAS_HUGE_FILES |
f49ad976 VZ |
310 | #define wxSeek wxPOSIX_IDENT(lseek) |
311 | #define wxLseek wxPOSIX_IDENT(lseek) | |
312 | #define wxTell wxPOSIX_IDENT(tell) | |
dedcebb9 VZ |
313 | #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES |
314 | ||
f49ad976 | 315 | #ifndef __WATCOMC__ |
1b96afaa VZ |
316 | #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) |
317 | // NB: this one is not POSIX and always has the underscore | |
318 | #define wxFsync _commit | |
dedcebb9 | 319 | |
1b96afaa VZ |
320 | // could be already defined by configure (Cygwin) |
321 | #ifndef HAVE_FSYNC | |
322 | #define HAVE_FSYNC | |
323 | #endif | |
324 | #endif // BORLANDC | |
1239ac2e | 325 | #endif |
f6bcfd97 | 326 | |
f49ad976 VZ |
327 | #define wxEof wxPOSIX_IDENT(eof) |
328 | ||
329 | // then the functions taking strings | |
d5e71e81 VZ |
330 | |
331 | // first the ANSI versions | |
332 | #define wxCRT_OpenA wxPOSIX_IDENT(open) | |
333 | #define wxCRT_AccessA wxPOSIX_IDENT(access) | |
5bd6ad08 | 334 | #define wxCRT_ChmodA wxPOSIX_IDENT(chmod) |
d5e71e81 VZ |
335 | #define wxCRT_MkDirA wxPOSIX_IDENT(mkdir) |
336 | #define wxCRT_RmDirA wxPOSIX_IDENT(rmdir) | |
337 | #ifdef wxHAS_HUGE_FILES | |
e33cedf4 VZ |
338 | // MinGW-64 provides underscore-less versions of all file functions |
339 | // except for this one. | |
340 | #ifdef __MINGW64__ | |
341 | #define wxCRT_StatA _stati64 | |
342 | #else | |
343 | #define wxCRT_StatA wxPOSIX_IDENT(stati64) | |
344 | #endif | |
d5e71e81 VZ |
345 | #else |
346 | // Unfortunately Watcom is not consistent | |
347 | #if defined(__OS2__) && defined(__WATCOMC__) | |
348 | #define wxCRT_StatA _stat | |
349 | #else | |
350 | #define wxCRT_StatA wxPOSIX_IDENT(stat) | |
351 | #endif | |
352 | #endif | |
353 | ||
354 | // then wide char ones | |
355 | #if wxUSE_UNICODE | |
356 | // special workaround for buggy wopen() in bcc 5.5 | |
357 | #if defined(__BORLANDC__) && \ | |
358 | (__BORLANDC__ >= 0x550 && __BORLANDC__ <= 0x551) | |
359 | WXDLLIMPEXP_BASE int wxCRT_OpenW(const wxChar *pathname, | |
360 | int flags, mode_t mode); | |
361 | #else | |
362 | #define wxCRT_OpenW _wopen | |
363 | #endif | |
364 | ||
365 | #define wxCRT_AccessW _waccess | |
5bd6ad08 | 366 | #define wxCRT_ChmodW _wchmod |
d5e71e81 VZ |
367 | #define wxCRT_MkDirW _wmkdir |
368 | #define wxCRT_RmDirW _wrmdir | |
369 | #ifdef wxHAS_HUGE_FILES | |
370 | #define wxCRT_StatW _wstati64 | |
371 | #else | |
372 | #define wxCRT_StatW _wstat | |
373 | #endif | |
374 | #endif // wxUSE_UNICODE | |
375 | ||
376 | ||
377 | // finally the default char-type versions | |
f6bcfd97 | 378 | #if wxUSE_UNICODE |
f030eeed | 379 | #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) |
6dad7fff | 380 | // implement the missing file functions in Win9x ourselves |
d5e71e81 VZ |
381 | WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, |
382 | int flags, int mode); | |
383 | WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, | |
384 | int mode); | |
5bd6ad08 VZ |
385 | WXDLLIMPEXP_BASE int wxMSLU__wchmod(const wxChar *name, |
386 | int mode); | |
d5e71e81 VZ |
387 | WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); |
388 | WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); | |
389 | ||
390 | WXDLLIMPEXP_BASE int | |
391 | wxMSLU__wstat(const wxChar *name, wxStructStat *buffer); | |
4876ba0b | 392 | |
52de37c7 | 393 | #define wxCRT_Open wxMSLU__wopen |
a62848fd | 394 | |
52de37c7 | 395 | #define wxCRT_Access wxMSLU__waccess |
5bd6ad08 | 396 | #define wxCRT_Chmod wxMSLU__wchmod |
52de37c7 VS |
397 | #define wxCRT_MkDir wxMSLU__wmkdir |
398 | #define wxCRT_RmDir wxMSLU__wrmdir | |
d5e71e81 | 399 | #define wxCRT_Stat wxMSLU__wstat |
f49ad976 | 400 | #else // !wxUSE_UNICODE_MSLU |
d5e71e81 VZ |
401 | #define wxCRT_Open wxCRT_OpenW |
402 | #define wxCRT_Access wxCRT_AccessW | |
5bd6ad08 | 403 | #define wxCRT_Chmod wxCRT_ChmodW |
d5e71e81 VZ |
404 | #define wxCRT_MkDir wxCRT_MkDirW |
405 | #define wxCRT_RmDir wxCRT_RmDirW | |
406 | #define wxCRT_Stat wxCRT_StatW | |
f49ad976 | 407 | #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU |
f6bcfd97 | 408 | #else // !wxUSE_UNICODE |
d5e71e81 VZ |
409 | #define wxCRT_Open wxCRT_OpenA |
410 | #define wxCRT_Access wxCRT_AccessA | |
5bd6ad08 | 411 | #define wxCRT_Chmod wxCRT_ChmodA |
d5e71e81 VZ |
412 | #define wxCRT_MkDir wxCRT_MkDirA |
413 | #define wxCRT_RmDir wxCRT_RmDirA | |
414 | #define wxCRT_Stat wxCRT_StatA | |
dedcebb9 | 415 | #endif // wxUSE_UNICODE/!wxUSE_UNICODE |
f6bcfd97 | 416 | |
d5e71e81 | 417 | |
f6bcfd97 | 418 | // constants (unless already defined by the user code) |
f49ad976 | 419 | #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS |
eb84314b VZ |
420 | #ifndef O_RDONLY |
421 | #define O_RDONLY _O_RDONLY | |
422 | #define O_WRONLY _O_WRONLY | |
423 | #define O_RDWR _O_RDWR | |
424 | #define O_EXCL _O_EXCL | |
425 | #define O_CREAT _O_CREAT | |
426 | #define O_BINARY _O_BINARY | |
427 | #endif | |
428 | ||
429 | #ifndef S_IFMT | |
430 | #define S_IFMT _S_IFMT | |
431 | #define S_IFDIR _S_IFDIR | |
432 | #define S_IFREG _S_IFREG | |
433 | #endif | |
f49ad976 | 434 | #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS |
6294ac2e | 435 | |
1ad688c9 | 436 | #ifdef wxHAS_HUGE_FILES |
224d978f | 437 | // wxFile is present and supports large files. |
3d3c6c45 | 438 | #if wxUSE_FILE |
82b99cf9 | 439 | #define wxHAS_LARGE_FILES |
3d3c6c45 | 440 | #endif |
224d978f MW |
441 | // wxFFile is present and supports large files |
442 | #if wxUSE_FFILE && defined wxHAS_HUGE_STDIO_FILES | |
443 | #define wxHAS_LARGE_FFILES | |
444 | #endif | |
3d3c6c45 | 445 | #endif |
dedcebb9 | 446 | |
224d978f | 447 | // private defines, undefine so that nobody gets tempted to use |
4ae9be50 | 448 | #undef wxHAS_HUGE_FILES |
224d978f | 449 | #undef wxHAS_HUGE_STDIO_FILES |
dedcebb9 | 450 | #else // Unix or Windows using unknown compiler, assume POSIX supported |
6294ac2e | 451 | typedef off_t wxFileOffset; |
68fe70ea | 452 | #ifdef HAVE_LARGEFILE_SUPPORT |
6294ac2e | 453 | #define wxFileOffsetFmtSpec wxLongLongFmtSpec |
bd3cea7d VZ |
454 | wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), |
455 | BadFileSizeType ); | |
3d3c6c45 | 456 | // wxFile is present and supports large files |
68fe70ea | 457 | #if wxUSE_FILE |
82b99cf9 | 458 | #define wxHAS_LARGE_FILES |
3d3c6c45 MW |
459 | #endif |
460 | // wxFFile is present and supports large files | |
68fe70ea | 461 | #if wxUSE_FFILE && (SIZEOF_LONG == 8 || defined HAVE_FSEEKO) |
82b99cf9 | 462 | #define wxHAS_LARGE_FFILES |
3d3c6c45 | 463 | #endif |
224d978f MW |
464 | #ifdef HAVE_FSEEKO |
465 | #define wxFseek fseeko | |
466 | #define wxFtell ftello | |
467 | #endif | |
6294ac2e | 468 | #else |
9a83f860 | 469 | #define wxFileOffsetFmtSpec wxT("") |
6294ac2e | 470 | #endif |
f6bcfd97 | 471 | // functions |
f6bcfd97 | 472 | #define wxClose close |
6294ac2e VZ |
473 | #define wxRead ::read |
474 | #define wxWrite ::write | |
f6bcfd97 | 475 | #define wxLseek lseek |
6294ac2e | 476 | #define wxSeek lseek |
52ca5b59 | 477 | #define wxFsync fsync |
f6bcfd97 BP |
478 | #define wxEof eof |
479 | ||
52de37c7 VS |
480 | #define wxCRT_MkDir mkdir |
481 | #define wxCRT_RmDir rmdir | |
f6bcfd97 BP |
482 | |
483 | #define wxTell(fd) lseek(fd, 0, SEEK_CUR) | |
484 | ||
f6bcfd97 | 485 | #define wxStructStat struct stat |
a62848fd | 486 | |
52de37c7 VS |
487 | #define wxCRT_Open open |
488 | #define wxCRT_Stat stat | |
489 | #define wxCRT_Lstat lstat | |
490 | #define wxCRT_Access access | |
5bd6ad08 | 491 | #define wxCRT_Chmod chmod |
194b2267 | 492 | |
dedcebb9 | 493 | #define wxHAS_NATIVE_LSTAT |
06e66bd0 | 494 | #endif // platforms |
f6bcfd97 | 495 | |
52de37c7 VS |
496 | // if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as |
497 | // wxCRT_Stat to avoid #ifdefs in the code using it | |
498 | #ifndef wxHAS_NATIVE_LSTAT | |
499 | #define wxCRT_Lstat wxCRT_Stat | |
500 | #endif | |
501 | ||
224d978f MW |
502 | // define wxFseek/wxFtell to large file versions if available (done above) or |
503 | // to fseek/ftell if not, to save ifdefs in using code | |
504 | #ifndef wxFseek | |
505 | #define wxFseek fseek | |
506 | #endif | |
507 | #ifndef wxFtell | |
508 | #define wxFtell ftell | |
509 | #endif | |
510 | ||
52de37c7 VS |
511 | inline int wxAccess(const wxString& path, mode_t mode) |
512 | { return wxCRT_Access(path.fn_str(), mode); } | |
5bd6ad08 VZ |
513 | inline int wxChmod(const wxString& path, mode_t mode) |
514 | { return wxCRT_Chmod(path.fn_str(), mode); } | |
52de37c7 VS |
515 | inline int wxOpen(const wxString& path, int flags, mode_t mode) |
516 | { return wxCRT_Open(path.fn_str(), flags, mode); } | |
d6f2a891 VZ |
517 | |
518 | // FIXME-CE: provide our own implementations of the missing CRT functions | |
519 | #ifndef __WXWINCE__ | |
520 | inline int wxStat(const wxString& path, wxStructStat *buf) | |
521 | { return wxCRT_Stat(path.fn_str(), buf); } | |
522 | inline int wxLstat(const wxString& path, wxStructStat *buf) | |
523 | { return wxCRT_Lstat(path.fn_str(), buf); } | |
52de37c7 VS |
524 | inline int wxRmDir(const wxString& path) |
525 | { return wxCRT_RmDir(path.fn_str()); } | |
715e4f7e VZ |
526 | #if (defined(__WINDOWS__) && !defined(__CYGWIN__)) \ |
527 | || (defined(__OS2__) && defined(__WATCOMC__)) | |
52de37c7 VS |
528 | inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0) |
529 | { return wxCRT_MkDir(path.fn_str()); } | |
530 | #else | |
531 | inline int wxMkDir(const wxString& path, mode_t mode) | |
532 | { return wxCRT_MkDir(path.fn_str(), mode); } | |
533 | #endif | |
d6f2a891 | 534 | #endif // !__WXWINCE__ |
52de37c7 | 535 | |
3d3c6c45 MW |
536 | #ifdef O_BINARY |
537 | #define wxO_BINARY O_BINARY | |
538 | #else | |
539 | #define wxO_BINARY 0 | |
540 | #endif | |
541 | ||
06e66bd0 VZ |
542 | #if defined(__VISAGECPP__) && __IBMCPP__ >= 400 |
543 | // | |
544 | // VisualAge C++ V4.0 cannot have any external linkage const decs | |
545 | // in headers included by more than one primary source | |
546 | // | |
30984dea | 547 | extern const int wxInvalidOffset; |
06e66bd0 | 548 | #else |
30984dea | 549 | const int wxInvalidOffset = -1; |
06e66bd0 | 550 | #endif |
f6bcfd97 | 551 | |
45ea509a VZ |
552 | // ---------------------------------------------------------------------------- |
553 | // functions | |
554 | // ---------------------------------------------------------------------------- | |
bddd7a8d | 555 | WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); |
c801d85f KB |
556 | |
557 | // does the path exist? (may have or not '/' or '\\' at the end) | |
e960c20e | 558 | WXDLLIMPEXP_BASE bool wxDirExists(const wxString& pathName); |
c801d85f | 559 | |
bddd7a8d | 560 | WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); |
c801d85f KB |
561 | |
562 | // Get filename | |
bddd7a8d VZ |
563 | WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path); |
564 | WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); | |
c801d85f KB |
565 | |
566 | // Get directory | |
bddd7a8d | 567 | WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); |
c801d85f | 568 | |
47d281e6 FM |
569 | // all deprecated functions below are deprecated in favour of wxFileName's methods |
570 | #if WXWIN_COMPATIBILITY_2_8 | |
c801d85f | 571 | |
47d281e6 FM |
572 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) ); |
573 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) ); | |
574 | ||
220ea2b9 VZ |
575 | wxDEPRECATED_BUT_USED_INTERNALLY( |
576 | WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) ); | |
577 | wxDEPRECATED_BUT_USED_INTERNALLY( | |
578 | WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) ); | |
c801d85f KB |
579 | |
580 | // Strip the extension, in situ | |
181dd701 VZ |
581 | // Deprecated in favour of wxFileName::StripExtension() but notice that their |
582 | // behaviour is slightly different, see the manual | |
47d281e6 FM |
583 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) ); |
584 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) ); | |
585 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) ); | |
c801d85f | 586 | |
ade35f11 | 587 | // Get a temporary filename |
d3b9f782 | 588 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = NULL) ); |
48598c66 | 589 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) ); |
c801d85f KB |
590 | |
591 | // Expand file name (~/ and ${OPENWINHOME}/ stuff) | |
48598c66 FM |
592 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) ); |
593 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) ); | |
47d281e6 | 594 | // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS) |
c801d85f KB |
595 | |
596 | // Contract w.r.t environment (</usr/openwin/lib, OPENWHOME> -> ${OPENWINHOME}/lib) | |
597 | // and make (if under the home tree) relative to home | |
598 | // [caller must copy-- volatile] | |
47d281e6 | 599 | wxDEPRECATED( |
bddd7a8d | 600 | WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, |
ade35f11 | 601 | const wxString& envname = wxEmptyString, |
47d281e6 FM |
602 | const wxString& user = wxEmptyString) ); |
603 | // DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir | |
c801d85f KB |
604 | |
605 | // Destructive removal of /./ and /../ stuff | |
48598c66 FM |
606 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxRealPath(char *path) ); |
607 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) ); | |
608 | wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) ); | |
47d281e6 | 609 | // DEPRECATED: use wxFileName::Normalize instead |
c801d85f KB |
610 | |
611 | // Allocate a copy of the full absolute path | |
47d281e6 FM |
612 | wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) ); |
613 | // DEPRECATED: use wxFileName::MakeAbsolute instead | |
614 | #endif | |
c801d85f KB |
615 | |
616 | // Get first file name matching given wild card. | |
617 | // Flags are reserved for future use. | |
618 | #define wxFILE 1 | |
619 | #define wxDIR 2 | |
52de37c7 | 620 | WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxString& spec, int flags = wxFILE); |
bddd7a8d | 621 | WXDLLIMPEXP_BASE wxString wxFindNextFile(); |
c801d85f KB |
622 | |
623 | // Does the pattern contain wildcards? | |
bddd7a8d | 624 | WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); |
c801d85f KB |
625 | |
626 | // Does the pattern match the text (usually a filename)? | |
a62848fd | 627 | // If dot_special is true, doesn't match * against . (eliminating |
c801d85f | 628 | // `hidden' dot files) |
a62848fd | 629 | WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); |
c801d85f KB |
630 | |
631 | // Concatenate two files to form third | |
bddd7a8d | 632 | WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); |
c801d85f KB |
633 | |
634 | // Copy file1 to file2 | |
bddd7a8d | 635 | WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, |
a62848fd | 636 | bool overwrite = true); |
c801d85f KB |
637 | |
638 | // Remove file | |
bddd7a8d | 639 | WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); |
c801d85f KB |
640 | |
641 | // Rename file | |
57e988b8 | 642 | WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); |
c801d85f KB |
643 | |
644 | // Get current working directory. | |
2587df2c VS |
645 | #if WXWIN_COMPATIBILITY_2_6 |
646 | // If buf is NULL, allocates space using new, else | |
647 | // copies into buf. | |
648 | // IMPORTANT NOTE getcwd is know not to work under some releases | |
649 | // of Win32s 1.3, according to MS release notes! | |
d3b9f782 | 650 | wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = NULL, int sz = 1000) ); |
2587df2c VS |
651 | // new and preferred version of wxGetWorkingDirectory |
652 | // NB: can't have the same name because of overloading ambiguity | |
653 | #endif // WXWIN_COMPATIBILITY_2_6 | |
bddd7a8d | 654 | WXDLLIMPEXP_BASE wxString wxGetCwd(); |
c801d85f KB |
655 | |
656 | // Set working directory | |
bddd7a8d | 657 | WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); |
c801d85f KB |
658 | |
659 | // Make directory | |
9508a23a | 660 | WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT); |
c801d85f KB |
661 | |
662 | // Remove directory. Flags reserved for future use. | |
bddd7a8d | 663 | WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); |
c801d85f | 664 | |
3c70014d | 665 | // Return the type of an open file |
0912690b | 666 | WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); |
9802983f | 667 | WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); |
3c70014d | 668 | |
2587df2c VS |
669 | #if WXWIN_COMPATIBILITY_2_6 |
670 | // compatibility defines, don't use in new code | |
671 | wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); | |
672 | inline bool wxPathExists(const wxChar *pszPathName) | |
673 | { | |
674 | return wxDirExists(pszPathName); | |
675 | } | |
676 | #endif //WXWIN_COMPATIBILITY_2_6 | |
677 | ||
3ff07edb RR |
678 | // permissions; these functions work both on files and directories: |
679 | WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); | |
680 | WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); | |
681 | WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); | |
682 | ||
ff69a290 | 683 | // ---------------------------------------------------------------------------- |
c801d85f | 684 | // separators in file names |
ff69a290 VZ |
685 | // ---------------------------------------------------------------------------- |
686 | ||
687 | // between file name and extension | |
223d09f6 | 688 | #define wxFILE_SEP_EXT wxT('.') |
ff69a290 VZ |
689 | |
690 | // between drive/volume name and the path | |
223d09f6 | 691 | #define wxFILE_SEP_DSK wxT(':') |
ff69a290 VZ |
692 | |
693 | // between the path components | |
223d09f6 KB |
694 | #define wxFILE_SEP_PATH_DOS wxT('\\') |
695 | #define wxFILE_SEP_PATH_UNIX wxT('/') | |
844f90fb | 696 | #define wxFILE_SEP_PATH_MAC wxT(':') |
ff69a290 | 697 | #define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']' |
c801d85f KB |
698 | |
699 | // separator in the path list (as in PATH environment variable) | |
03e11df5 GD |
700 | // there is no PATH variable in Classic Mac OS so just use the |
701 | // semicolon (it must be different from the file name separator) | |
c801d85f | 702 | // NB: these are strings and not characters on purpose! |
223d09f6 KB |
703 | #define wxPATH_SEP_DOS wxT(";") |
704 | #define wxPATH_SEP_UNIX wxT(":") | |
03e11df5 | 705 | #define wxPATH_SEP_MAC wxT(";") |
c801d85f KB |
706 | |
707 | // platform independent versions | |
77a80672 VZ |
708 | #if defined(__UNIX__) && !defined(__OS2__) |
709 | // CYGWIN also uses UNIX settings | |
7af89395 VZ |
710 | #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX |
711 | #define wxPATH_SEP wxPATH_SEP_UNIX | |
844f90fb | 712 | #elif defined(__MAC__) |
bedaf53e | 713 | #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC |
3369df87 | 714 | #define wxPATH_SEP wxPATH_SEP_MAC |
1777b9bb | 715 | #else // Windows and OS/2 |
7af89395 VZ |
716 | #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS |
717 | #define wxPATH_SEP wxPATH_SEP_DOS | |
c801d85f KB |
718 | #endif // Unix/Windows |
719 | ||
92abb45d VZ |
720 | // this is useful for wxString::IsSameAs(): to compare two file names use |
721 | // filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) | |
28e5e577 | 722 | #if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) |
a62848fd | 723 | #define wxARE_FILENAMES_CASE_SENSITIVE true |
3369df87 | 724 | #else // Windows, Mac OS and OS/2 |
a62848fd | 725 | #define wxARE_FILENAMES_CASE_SENSITIVE false |
92abb45d VZ |
726 | #endif // Unix/Windows |
727 | ||
c801d85f | 728 | // is the char a path separator? |
9d2f3c71 | 729 | inline bool wxIsPathSeparator(wxChar c) |
903b61cc VZ |
730 | { |
731 | // under DOS/Windows we should understand both Unix and DOS file separators | |
a62848fd | 732 | #if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) |
903b61cc VZ |
733 | return c == wxFILE_SEP_PATH; |
734 | #else | |
735 | return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; | |
736 | #endif | |
737 | } | |
c801d85f KB |
738 | |
739 | // does the string ends with path separator? | |
52de37c7 | 740 | WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename); |
c801d85f | 741 | |
47d281e6 | 742 | #if WXWIN_COMPATIBILITY_2_8 |
92abb45d VZ |
743 | // split the full path into path (including drive for DOS), name and extension |
744 | // (understands both '/' and '\\') | |
0253bbba | 745 | // Deprecated in favour of wxFileName::SplitPath |
47d281e6 FM |
746 | wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, |
747 | wxString *pstrPath, | |
748 | wxString *pstrName, | |
749 | wxString *pstrExt) ); | |
750 | #endif | |
92abb45d | 751 | |
c801d85f | 752 | // find a file in a list of directories, returns false if not found |
52de37c7 | 753 | WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile); |
c801d85f | 754 | |
631f1bfe JS |
755 | // Get the OS directory if appropriate (such as the Windows directory). |
756 | // On non-Windows platform, probably just return the empty string. | |
bddd7a8d | 757 | WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); |
631f1bfe | 758 | |
2c5e5cbd VS |
759 | #if wxUSE_DATETIME |
760 | ||
a47ce4a7 | 761 | // Get file modification time |
bddd7a8d | 762 | WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); |
a47ce4a7 | 763 | |
2c5e5cbd VS |
764 | #endif // wxUSE_DATETIME |
765 | ||
9e152a55 WS |
766 | // Parses the wildCard, returning the number of filters. |
767 | // Returns 0 if none or if there's a problem, | |
768 | // The arrays will contain an equal number of items found before the error. | |
769 | // wildCard is in the form: | |
770 | // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" | |
daf32463 | 771 | WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); |
9e152a55 | 772 | |
45ea509a VZ |
773 | // ---------------------------------------------------------------------------- |
774 | // classes | |
775 | // ---------------------------------------------------------------------------- | |
776 | ||
8482e4bd VZ |
777 | #ifdef __UNIX__ |
778 | ||
779 | // set umask to the given value in ctor and reset it to the old one in dtor | |
780 | class WXDLLIMPEXP_BASE wxUmaskChanger | |
781 | { | |
782 | public: | |
783 | // change the umask to the given one if it is not -1: this allows to write | |
784 | // the same code whether you really want to change umask or not, as is in | |
785 | // wxFileConfig::Flush() for example | |
786 | wxUmaskChanger(int umaskNew) | |
787 | { | |
835fab50 | 788 | m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew); |
8482e4bd VZ |
789 | } |
790 | ||
791 | ~wxUmaskChanger() | |
792 | { | |
793 | if ( m_umaskOld != -1 ) | |
794 | umask((mode_t)m_umaskOld); | |
795 | } | |
796 | ||
797 | private: | |
798 | int m_umaskOld; | |
799 | }; | |
800 | ||
801 | // this macro expands to an "anonymous" wxUmaskChanger object under Unix and | |
802 | // nothing elsewhere | |
803 | #define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m) | |
804 | ||
805 | #else // !__UNIX__ | |
806 | ||
807 | #define wxCHANGE_UMASK(m) | |
808 | ||
809 | #endif // __UNIX__/!__UNIX__ | |
810 | ||
811 | ||
c801d85f | 812 | // Path searching |
8daf3c36 | 813 | class WXDLLIMPEXP_BASE wxPathList : public wxArrayString |
c801d85f | 814 | { |
a6f6393c | 815 | public: |
8daf3c36 VZ |
816 | wxPathList() {} |
817 | wxPathList(const wxArrayString &arr) | |
818 | { Add(arr); } | |
819 | ||
7af89395 VZ |
820 | // Adds all paths in environment variable |
821 | void AddEnvList(const wxString& envVariable); | |
c330a2cf | 822 | |
8daf3c36 | 823 | // Adds given path to this list |
34e2d943 | 824 | bool Add(const wxString& path); |
8daf3c36 VZ |
825 | void Add(const wxArrayString &paths); |
826 | ||
7af89395 | 827 | // Find the first full path for which the file exists |
8daf3c36 VZ |
828 | wxString FindValidPath(const wxString& filename) const; |
829 | ||
7af89395 VZ |
830 | // Find the first full path for which the file exists; ensure it's an |
831 | // absolute path that gets returned. | |
8daf3c36 VZ |
832 | wxString FindAbsoluteValidPath(const wxString& filename) const; |
833 | ||
7af89395 | 834 | // Given full path and filename, add path to list |
34e2d943 | 835 | bool EnsureFileAccessible(const wxString& path); |
2587df2c VS |
836 | |
837 | #if WXWIN_COMPATIBILITY_2_6 | |
838 | // Returns true if the path is in the list | |
839 | wxDEPRECATED( bool Member(const wxString& path) const ); | |
840 | #endif | |
c801d85f KB |
841 | }; |
842 | ||
8daf3c36 | 843 | #endif // _WX_FILEFN_H_ |