mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-05 15:27:04 +00:00
LibCore: Port File to Windows
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
This commit is contained in:
@@ -8,7 +8,15 @@
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(AK_OS_WINDOWS)
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include <WinSock2.h>
|
||||
# define STDIN_FILENO _fileno(stdin)
|
||||
# define STDOUT_FILENO _fileno(stdout)
|
||||
# define STDERR_FILENO _fileno(stderr)
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
||||
@@ -85,8 +93,14 @@ int File::open_mode_to_options(OpenMode mode)
|
||||
flags |= O_EXCL;
|
||||
if (!has_flag(mode, OpenMode::KeepOnExec))
|
||||
flags |= O_CLOEXEC;
|
||||
if (has_flag(mode, OpenMode::Nonblocking))
|
||||
if (has_flag(mode, OpenMode::Nonblocking)) {
|
||||
#if !defined(AK_OS_WINDOWS)
|
||||
flags |= O_NONBLOCK;
|
||||
#else
|
||||
dbgln("Core::File::OpenMode::Nonblocking is not implemented");
|
||||
VERIFY_NOT_REACHED();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Some open modes, like `ReadWrite` imply the ability to create the file if it doesn't exist.
|
||||
// Certain applications may not want this privledge, and for compability reasons, this is
|
||||
|
||||
Reference in New Issue
Block a user