diff options
author | Sadie Powell <sadie@witchery.services> | 2022-12-17 15:44:44 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2022-12-17 16:03:28 +0000 |
commit | 3f3062a0773d0a45941f6db2534989a07256f267 (patch) | |
tree | 3e9080e751e5a26a2d49ef4412833ba6456edb18 /src/win32 | |
parent | 8a8fb7725b4433b725866cc8842edf40ec8b7025 (diff) |
Use <filesystem> instead of opendir/readdir/closedir.
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/anope_windows.h | 1 | ||||
-rw-r--r-- | src/win32/dir/dir.cpp | 48 | ||||
-rw-r--r-- | src/win32/dir/dir.h | 27 |
3 files changed, 0 insertions, 76 deletions
diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h index 7417b0f23..3ccb34198 100644 --- a/src/win32/anope_windows.h +++ b/src/win32/anope_windows.h @@ -51,7 +51,6 @@ #define EINPROGRESS WSAEWOULDBLOCK #include "socket.h" -#include "dir/dir.h" #include "dl/dl.h" #include "pipe/pipe.h" #include "pthread/pthread.h" diff --git a/src/win32/dir/dir.cpp b/src/win32/dir/dir.cpp deleted file mode 100644 index 8c8cdf907..000000000 --- a/src/win32/dir/dir.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* POSIX emulation layer for Windows. - * - * (C) 2008-2022 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - */ - -#include "dir.h" -#include <stdio.h> - -DIR *opendir(const char *path) -{ - char real_path[MAX_PATH]; - _snprintf(real_path, sizeof(real_path), "%s/*", path); - - DIR *d = new DIR(); - d->handle = FindFirstFile(real_path, &d->data); - d->read_first = false; - - if (d->handle == INVALID_HANDLE_VALUE) - { - delete d; - return NULL; - } - - return d; -} - -dirent *readdir(DIR *d) -{ - if (d->read_first == false) - d->read_first = true; - else if (!FindNextFile(d->handle, &d->data)) - return NULL; - - d->ent.d_ino = 1; - d->ent.d_name = d->data.cFileName; - - return &d->ent; -} - -int closedir(DIR *d) -{ - FindClose(d->handle); - delete d; - return 0; -} diff --git a/src/win32/dir/dir.h b/src/win32/dir/dir.h deleted file mode 100644 index bfacdd456..000000000 --- a/src/win32/dir/dir.h +++ /dev/null @@ -1,27 +0,0 @@ -/* POSIX emulation layer for Windows. - * - * (C) 2008-2022 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - */ - -#include <windows.h> - -struct dirent -{ - int d_ino; - char *d_name; -}; - -struct DIR -{ - dirent ent; - HANDLE handle; - WIN32_FIND_DATA data; - bool read_first; -}; - -DIR *opendir(const char *); -dirent *readdir(DIR *); -int closedir(DIR *); |