mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibCore: Add S_ISDIR, S_ISREG to System.h on Windows
Before this commit, LibCore/System.h exposed only part of System::stat API on Windows. Namely, users of Core::System::stat had to #include <dirent.h> in order to check the return value of stat. It is OK for low-level libs like LibCore/LibFileSystem, but S_ISDIR is also used in LibWeb\Loader\GeneratedPagesLoader.cpp. We want to avoid platform #ifdefs in LibWeb.
This commit is contained in:
parent
6b86d8a44d
commit
fe43712e72
Notes:
github-actions[bot]
2025-02-13 01:43:13 +00:00
Author: https://github.com/stasoid Commit: https://github.com/LadybirdBrowser/ladybird/commit/fe43712e726 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3000 Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 3 additions and 14 deletions
|
@ -9,10 +9,6 @@
|
|||
#include <LibCore/ResourceImplementationFile.h>
|
||||
#include <LibCore/System.h>
|
||||
|
||||
#if defined(AK_OS_WINDOWS)
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
||||
static OwnPtr<ResourceImplementation> s_the;
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include <LibCore/ResourceImplementationFile.h>
|
||||
#include <LibCore/System.h>
|
||||
|
||||
#if defined(AK_OS_WINDOWS)
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
||||
ResourceImplementationFile::ResourceImplementationFile(String base_directory)
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
# include <utime.h>
|
||||
#else
|
||||
# define O_CLOEXEC O_NOINHERIT
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
using sighandler_t = void (*)(int);
|
||||
using socklen_t = int;
|
||||
#endif
|
||||
|
|
|
@ -5,8 +5,3 @@ endif()
|
|||
|
||||
serenity_lib(LibFileSystem filesystem)
|
||||
target_link_libraries(LibFileSystem PRIVATE LibCoreMinimal)
|
||||
|
||||
if (WIN32)
|
||||
find_path(DIRENT_INCLUDE_DIR dirent.h REQUIRED)
|
||||
target_include_directories(LibFileSystem PRIVATE ${DIRENT_INCLUDE_DIR})
|
||||
endif()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#elif defined(AK_OS_LINUX)
|
||||
# include <linux/fs.h>
|
||||
#elif defined(AK_OS_WINDOWS)
|
||||
# include <dirent.h>
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
// On Linux distros that use glibc `basename` is defined as a macro that expands to `__xpg_basename`, so we undefine it
|
||||
|
|
Loading…
Add table
Reference in a new issue