system/FileDescriptor: add Open() overload with wchar_t path
This commit is contained in:
parent
cf0120e8e0
commit
eb0ff32efb
|
@ -74,6 +74,17 @@ FileDescriptor::Open(const char *pathname, int flags, mode_t mode) noexcept
|
||||||
return IsDefined();
|
return IsDefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
bool
|
||||||
|
FileDescriptor::Open(const wchar_t *pathname, int flags, mode_t mode) noexcept
|
||||||
|
{
|
||||||
|
fd = ::_wopen(pathname, flags | O_NOCTTY | O_CLOEXEC, mode);
|
||||||
|
return IsDefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FileDescriptor::OpenReadOnly(const char *pathname) noexcept
|
FileDescriptor::OpenReadOnly(const char *pathname) noexcept
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An OO wrapper for a UNIX file descriptor.
|
* An OO wrapper for a UNIX file descriptor.
|
||||||
*
|
*
|
||||||
|
@ -97,6 +101,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Open(const char *pathname, int flags, mode_t mode=0666) noexcept;
|
bool Open(const char *pathname, int flags, mode_t mode=0666) noexcept;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool Open(const wchar_t *pathname, int flags, mode_t mode=0666) noexcept;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool OpenReadOnly(const char *pathname) noexcept;
|
bool OpenReadOnly(const char *pathname) noexcept;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
Loading…
Reference in New Issue