• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 //  Copyright (c) 2020 Alexander Grund
3 //
4 //  Distributed under the Boost Software License, Version 1.0. (See
5 //  accompanying file LICENSE or copy at  http://www.boost.org/LICENSE_1_0.txt)
6 //
7 
8 #define BOOST_NOWIDE_SOURCE
9 
10 #if(defined(__MINGW32__) || defined(__CYGWIN__)) && defined(__STRICT_ANSI__)
11 // Need the _w* functions which are extensions on MinGW/Cygwin
12 #undef __STRICT_ANSI__
13 #endif
14 
15 #include <boost/nowide/config.hpp>
16 
17 #if defined(BOOST_WINDOWS)
18 
19 #include <boost/nowide/stackstring.hpp>
20 #include <boost/nowide/stat.hpp>
21 #include <errno.h>
22 
23 namespace boost {
24 namespace nowide {
25     namespace detail {
stat(const char * path,posix_stat_t * buffer,size_t buffer_size)26         int stat(const char* path, posix_stat_t* buffer, size_t buffer_size)
27         {
28             if(sizeof(*buffer) != buffer_size)
29             {
30                 errno = EINVAL;
31                 return EINVAL;
32             }
33             const wstackstring wpath(path);
34             return _wstat(wpath.get(), buffer);
35         }
36     } // namespace detail
stat(const char * path,stat_t * buffer)37     int stat(const char* path, stat_t* buffer)
38     {
39         const wstackstring wpath(path);
40         return _wstat64(wpath.get(), buffer);
41     }
42 } // namespace nowide
43 } // namespace boost
44 
45 #endif
46