1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Everywhere: Use LibFileSystem where trivial

This commit is contained in:
Cameron Youell 2023-03-22 02:35:30 +11:00 committed by Linus Groh
parent edab0cbf41
commit 1d24f394c6
115 changed files with 275 additions and 228 deletions

View file

@ -7,7 +7,7 @@
#include "ProjectBuilder.h"
#include <AK/LexicalPath.h>
#include <LibCore/Command.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibRegex/Regex.h>
#include <fcntl.h>
#include <sys/stat.h>
@ -124,15 +124,15 @@ ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_p
ErrorOr<void> ProjectBuilder::initialize_build_directory()
{
if (!Core::DeprecatedFile::exists(build_directory())) {
if (!FileSystem::exists(build_directory())) {
if (mkdir(LexicalPath::join(build_directory()).string().characters(), 0700)) {
return Error::from_errno(errno);
}
}
auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt"sv).string();
if (Core::DeprecatedFile::exists(cmake_file_path))
MUST(Core::DeprecatedFile::remove(cmake_file_path, Core::DeprecatedFile::RecursionMode::Disallowed));
if (FileSystem::exists(cmake_file_path))
MUST(FileSystem::remove(cmake_file_path, FileSystem::RecursionMode::Disallowed));
auto cmake_file = TRY(Core::File::open(cmake_file_path, Core::File::OpenMode::Write));
TRY(cmake_file->write_until_depleted(generate_cmake_file_content().bytes()));
@ -150,7 +150,7 @@ Optional<DeprecatedString> ProjectBuilder::find_cmake_file_for(StringView file_p
auto directory = LexicalPath::dirname(file_path);
while (!directory.is_empty()) {
auto cmake_path = LexicalPath::join(m_project_root, directory, "CMakeLists.txt"sv);
if (Core::DeprecatedFile::exists(cmake_path.string()))
if (FileSystem::exists(cmake_path.string()))
return cmake_path.string();
directory = LexicalPath::dirname(directory);
}