@@ -104,7 +104,11 @@ namespace pathUtils {
104
104
template <>
105
105
inline bool pathExists (const char * LIBPLZMA_NONNULL path, bool * LIBPLZMA_NULLABLE isDir) noexcept {
106
106
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
107
+ # if defined(LIBPLZMA_MINGW)
108
+ if (::_access (path, F_OK) == 0 ) {
109
+ # else
107
110
if (::_access (path, 0 ) == 0 ) {
111
+ # endif
108
112
if (isDir) {
109
113
struct _stat statbuf;
110
114
if ((::_stat (path, &statbuf) == 0 ) && (S_ISDIR (statbuf.st_mode ))) {
@@ -188,7 +192,11 @@ namespace pathUtils {
188
192
template <>
189
193
inline bool pathReadable (const wchar_t * LIBPLZMA_NONNULL path) noexcept {
190
194
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
195
+ # if defined(defined(LIBPLZMA_MINGW))
196
+ return (::_waccess (path, R_OK) == 0 );
197
+ # else
191
198
return (::_waccess (path, 4 ) == 0 );
199
+ # endif
192
200
#else
193
201
assert (0 );
194
202
return false ;
@@ -198,7 +206,11 @@ namespace pathUtils {
198
206
template <>
199
207
inline bool pathReadable (const char * LIBPLZMA_NONNULL path) noexcept {
200
208
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
209
+ # if defined(LIBPLZMA_MINGW)
210
+ return (::_access (path, R_OK) == 0 );
211
+ # else
201
212
return (::_access (path, 4 ) == 0 );
213
+ # endif
202
214
#elif defined(LIBPLZMA_POSIX)
203
215
return (::access (path, R_OK) == 0 );
204
216
#endif
@@ -210,7 +222,11 @@ namespace pathUtils {
210
222
template <>
211
223
inline bool pathWritable (const wchar_t * LIBPLZMA_NONNULL path) noexcept {
212
224
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
225
+ # if defined(LIBPLZMA_MINGW)
226
+ return (::_waccess (path, W_OK) == 0 );
227
+ # else
213
228
return (::_waccess (path, 2 ) == 0 );
229
+ # endif
214
230
#else
215
231
assert (0 );
216
232
return false ;
@@ -220,7 +236,11 @@ namespace pathUtils {
220
236
template <>
221
237
inline bool pathWritable (const char * LIBPLZMA_NONNULL path) noexcept {
222
238
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
239
+ # if defined(LIBPLZMA_MINGW)
240
+ return (::_access (path, W_OK) == 0 );
241
+ # else
223
242
return (::_access (path, 2 ) == 0 );
243
+ # endif
224
244
#elif defined(LIBPLZMA_POSIX)
225
245
return (::access (path, W_OK) == 0 );
226
246
#endif
@@ -232,7 +252,11 @@ namespace pathUtils {
232
252
template <>
233
253
inline bool pathReadableAndWritable (const wchar_t * LIBPLZMA_NONNULL path) noexcept {
234
254
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
255
+ # if defined(LIBPLZMA_MINGW)
256
+ return (::_waccess (path, R_OK | W_OK) == 0 );
257
+ # else
235
258
return (::_waccess (path, 6 ) == 0 );
259
+ # endif
236
260
#else
237
261
assert (0 );
238
262
return false ;
@@ -242,7 +266,11 @@ namespace pathUtils {
242
266
template <>
243
267
inline bool pathReadableAndWritable (const char * LIBPLZMA_NONNULL path) noexcept {
244
268
#if defined(LIBPLZMA_MSC) || defined(LIBPLZMA_MINGW)
269
+ # if defined(LIBPLZMA_MINGW)
270
+ return (::_access (path, R_OK | W_OK) == 0 );
271
+ # else
245
272
return (::_access (path, 6 ) == 0 );
273
+ # endif
246
274
#elif defined(LIBPLZMA_POSIX)
247
275
return (::access (path, R_OK | W_OK) == 0 );
248
276
#endif
0 commit comments