mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibCore: Port File
to Windows
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
This commit is contained in:
parent
f6430035e7
commit
6b73a2d8a4
Notes:
github-actions[bot]
2024-10-20 16:19:04 +00:00
Author: https://github.com/stasoid Commit: https://github.com/LadybirdBrowser/ladybird/commit/6b73a2d8a49 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1864 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue