diff options
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibFileSystem/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibFileSystem/TempFile.cpp (renamed from Userland/Libraries/LibCore/TempFile.cpp) | 32 | ||||
-rw-r--r-- | Userland/Libraries/LibFileSystem/TempFile.h (renamed from Userland/Libraries/LibCore/TempFile.h) | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibCore/CMakeLists.txt b/Userland/Libraries/LibCore/CMakeLists.txt index 6dee12a65c..1a5b3fcbd3 100644 --- a/Userland/Libraries/LibCore/CMakeLists.txt +++ b/Userland/Libraries/LibCore/CMakeLists.txt @@ -30,7 +30,6 @@ set(SOURCES System.cpp SystemServerTakeover.cpp TCPServer.cpp - TempFile.cpp Timer.cpp UDPServer.cpp Version.cpp diff --git a/Userland/Libraries/LibFileSystem/CMakeLists.txt b/Userland/Libraries/LibFileSystem/CMakeLists.txt index 1e4e1871ff..e9ec24bdbf 100644 --- a/Userland/Libraries/LibFileSystem/CMakeLists.txt +++ b/Userland/Libraries/LibFileSystem/CMakeLists.txt @@ -1,5 +1,6 @@ set(SOURCES FileSystem.cpp + TempFile.cpp ) serenity_lib(LibFileSystem filesystem) diff --git a/Userland/Libraries/LibCore/TempFile.cpp b/Userland/Libraries/LibFileSystem/TempFile.cpp index 8558847e43..9f433acaea 100644 --- a/Userland/Libraries/LibCore/TempFile.cpp +++ b/Userland/Libraries/LibFileSystem/TempFile.cpp @@ -1,14 +1,27 @@ /* * Copyright (c) 2020-2023, the SerenityOS developers. + * Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com> * * SPDX-License-Identifier: BSD-2-Clause */ -#include "TempFile.h" -#include <LibCore/DeprecatedFile.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> +#include <LibFileSystem/TempFile.h> -namespace Core { +namespace FileSystem { + +TempFile::~TempFile() +{ + // Temporary files aren't removed by anyone else, so we must do it ourselves. + auto recursion_mode = RecursionMode::Disallowed; + if (m_type == Type::Directory) + recursion_mode = RecursionMode::Allowed; + + auto result = FileSystem::remove(m_path, recursion_mode); + if (result.is_error()) + warnln("Removal of temporary file failed '{}': {}", m_path, result.error().string_literal()); +} ErrorOr<NonnullOwnPtr<TempFile>> TempFile::create_temp_directory() { @@ -27,17 +40,4 @@ ErrorOr<NonnullOwnPtr<TempFile>> TempFile::create_temp_file() return adopt_nonnull_own_or_enomem(new (nothrow) TempFile(Type::File, string)); } -TempFile::~TempFile() -{ - // Temporary files aren't removed by anyone else, so we must do it ourselves. - auto recursion_mode = DeprecatedFile::RecursionMode::Disallowed; - if (m_type == Type::Directory) - recursion_mode = DeprecatedFile::RecursionMode::Allowed; - - auto result = DeprecatedFile::remove(m_path, recursion_mode); - if (result.is_error()) { - warnln("Removal of temporary file failed: {}", result.error().string_literal()); - } -} - } diff --git a/Userland/Libraries/LibCore/TempFile.h b/Userland/Libraries/LibFileSystem/TempFile.h index ac1743a165..038978f916 100644 --- a/Userland/Libraries/LibCore/TempFile.h +++ b/Userland/Libraries/LibFileSystem/TempFile.h @@ -1,16 +1,16 @@ /* * Copyright (c) 2020-2023, the SerenityOS developers. + * Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com> * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once -#include <AK/Error.h> -#include <AK/NonnullOwnPtr.h> +#include <AK/Forward.h> #include <AK/String.h> -namespace Core { +namespace FileSystem { class TempFile { |