summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/usr/share/man/man2/readlink.md8
-rw-r--r--Ladybird/AndroidPlatform.cpp5
-rw-r--r--Ladybird/Utilities.cpp4
-rw-r--r--Ladybird/WebContent/main.cpp1
-rw-r--r--Ladybird/WebContentView.cpp1
-rw-r--r--Ladybird/main.cpp6
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp4
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp4
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp4
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp6
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h1
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp1
-rw-r--r--Meta/Lagom/Tools/ConfigureComponents/main.cpp6
-rw-r--r--Meta/Lagom/Tools/IPCMagicLinter/main.cpp4
-rw-r--r--Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch6
-rw-r--r--Tests/Kernel/TestKernelFilePermissions.cpp4
-rw-r--r--Tests/LibC/TestIo.cpp4
-rw-r--r--Tests/LibC/TestLibCMkTemp.cpp10
-rw-r--r--Tests/LibCore/TestLibCoreIODevice.cpp16
-rw-r--r--Tests/LibELF/test-elf.cpp12
-rw-r--r--Tests/LibJS/test-test262.cpp4
-rw-r--r--Tests/LibTLS/TestTLSHandshake.cpp6
-rw-r--r--Userland/Applications/3DFileViewer/MeshLoader.h4
-rw-r--r--Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp4
-rw-r--r--Userland/Applications/3DFileViewer/WavefrontOBJLoader.h2
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp15
-rw-r--r--Userland/Applications/Assistant/Providers.cpp2
-rw-r--r--Userland/Applications/Browser/main.cpp6
-rw-r--r--Userland/Applications/CrashReporter/main.cpp3
-rw-r--r--Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp1
-rw-r--r--Userland/Applications/Escalator/main.cpp4
-rw-r--r--Userland/Applications/FileManager/DirectoryView.cpp10
-rw-r--r--Userland/Applications/FileManager/FileOperationProgressWidget.cpp1
-rw-r--r--Userland/Applications/FileManager/FileUtils.cpp4
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.cpp5
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.h1
-rw-r--r--Userland/Applications/FileManager/main.cpp22
-rw-r--r--Userland/Applications/Help/MainWidget.cpp1
-rw-r--r--Userland/Applications/HexEditor/HexDocument.h4
-rw-r--r--Userland/Applications/ImageViewer/ViewWidget.cpp4
-rw-r--r--Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp4
-rw-r--r--Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp1
-rw-r--r--Userland/Applications/NetworkSettings/main.cpp1
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp1
-rw-r--r--Userland/Applications/PartitionEditor/PartitionModel.cpp3
-rw-r--r--Userland/Applications/PartitionEditor/main.cpp3
-rw-r--r--Userland/Applications/Run/RunWindow.cpp6
-rw-r--r--Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp4
-rw-r--r--Userland/Applications/SoundPlayer/Player.cpp4
-rw-r--r--Userland/Applications/SoundPlayer/Playlist.cpp6
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp8
-rw-r--r--Userland/Applications/Spreadsheet/ImportDialog.cpp1
-rw-r--r--Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp1
-rw-r--r--Userland/Applications/Spreadsheet/Spreadsheet.cpp4
-rw-r--r--Userland/Applications/Spreadsheet/main.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp4
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.cpp4
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.h2
-rw-r--r--Userland/Applications/Terminal/main.cpp2
-rw-r--r--Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp1
-rw-r--r--Userland/Applications/TextEditor/FileArgument.cpp1
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp1
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.cpp4
-rw-r--r--Userland/Applications/ThemeEditor/main.cpp2
-rw-r--r--Userland/Demos/CatDog/CatDog.h1
-rw-r--r--Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp6
-rw-r--r--Userland/DevTools/HackStudio/Editor.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Git/GitWidget.cpp1
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp22
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp1
-rw-r--r--Userland/DevTools/HackStudio/Project.cpp4
-rw-r--r--Userland/DevTools/HackStudio/ProjectBuilder.cpp10
-rw-r--r--Userland/DevTools/HackStudio/ProjectTemplate.cpp10
-rw-r--r--Userland/DevTools/HackStudio/main.cpp8
-rw-r--r--Userland/DevTools/Profiler/Process.cpp4
-rw-r--r--Userland/DevTools/SQLStudio/MainWidget.cpp4
-rw-r--r--Userland/DevTools/UserspaceEmulator/Emulator.cpp5
-rw-r--r--Userland/DevTools/UserspaceEmulator/main.cpp5
-rw-r--r--Userland/Games/Chess/Engine.cpp10
-rw-r--r--Userland/Libraries/LibAudio/WavLoader.h1
-rw-r--r--Userland/Libraries/LibAudio/WavWriter.cpp3
-rw-r--r--Userland/Libraries/LibAudio/WavWriter.h9
-rw-r--r--Userland/Libraries/LibC/unistd.cpp4
-rw-r--r--Userland/Libraries/LibChess/UCIEndpoint.cpp1
-rw-r--r--Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp4
-rw-r--r--Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp4
-rw-r--r--Userland/Libraries/LibConfig/Client.h1
-rw-r--r--Userland/Libraries/LibCore/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibCore/Command.cpp6
-rw-r--r--Userland/Libraries/LibCore/DeprecatedFile.cpp (renamed from Userland/Libraries/LibCore/File.cpp)106
-rw-r--r--Userland/Libraries/LibCore/DeprecatedFile.h (renamed from Userland/Libraries/LibCore/File.h)22
-rw-r--r--Userland/Libraries/LibCore/Forward.h2
-rw-r--r--Userland/Libraries/LibCore/Group.cpp1
-rw-r--r--Userland/Libraries/LibCore/Stream.cpp2
-rw-r--r--Userland/Libraries/LibCore/System.cpp6
-rw-r--r--Userland/Libraries/LibCore/TempFile.cpp8
-rw-r--r--Userland/Libraries/LibCoredump/Backtrace.cpp4
-rw-r--r--Userland/Libraries/LibCoredump/Reader.cpp4
-rw-r--r--Userland/Libraries/LibCpp/Tests/parser/strace.ast20
-rw-r--r--Userland/Libraries/LibCpp/Tests/parser/strace.cpp4
-rw-r--r--Userland/Libraries/LibDebug/DebugSession.cpp6
-rw-r--r--Userland/Libraries/LibFileSystemAccessClient/Client.cpp17
-rw-r--r--Userland/Libraries/LibFileSystemAccessClient/Client.h4
-rw-r--r--Userland/Libraries/LibGUI/AbstractThemePreview.cpp1
-rw-r--r--Userland/Libraries/LibGUI/CommonLocationsProvider.cpp4
-rw-r--r--Userland/Libraries/LibGUI/FileIconProvider.cpp6
-rw-r--r--Userland/Libraries/LibGUI/FilePicker.cpp4
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.cpp4
-rw-r--r--Userland/Libraries/LibGUI/JsonArrayModel.cpp8
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp2
-rw-r--r--Userland/Libraries/LibGfx/Font/FontDatabase.cpp4
-rw-r--r--Userland/Libraries/LibIDL/IDLParser.cpp8
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp12
-rw-r--r--Userland/Libraries/LibKeyboard/CharacterMapFile.cpp4
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp8
-rw-r--r--Userland/Libraries/LibManual/Node.cpp6
-rw-r--r--Userland/Libraries/LibManual/SectionNode.cpp4
-rw-r--r--Userland/Libraries/LibPartition/EBRPartitionTable.cpp10
-rw-r--r--Userland/Libraries/LibPartition/EBRPartitionTable.h6
-rw-r--r--Userland/Libraries/LibPartition/GUIDPartitionTable.cpp8
-rw-r--r--Userland/Libraries/LibPartition/GUIDPartitionTable.h4
-rw-r--r--Userland/Libraries/LibPartition/MBRPartitionTable.cpp12
-rw-r--r--Userland/Libraries/LibPartition/MBRPartitionTable.h8
-rw-r--r--Userland/Libraries/LibPartition/PartitionTable.cpp3
-rw-r--r--Userland/Libraries/LibPartition/PartitionTable.h7
-rw-r--r--Userland/Libraries/LibSQL/BTree.h1
-rw-r--r--Userland/Libraries/LibSQL/SQLClient.cpp6
-rw-r--r--Userland/Libraries/LibSymbolication/Symbolication.cpp10
-rw-r--r--Userland/Libraries/LibTLS/TLSv12.cpp1
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunner.h1
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp7
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp1
-rw-r--r--Userland/Libraries/LibWebView/RequestServerAdapter.cpp1
-rw-r--r--Userland/Services/AudioServer/Mixer.cpp3
-rw-r--r--Userland/Services/AudioServer/Mixer.h3
-rw-r--r--Userland/Services/ChessEngine/ChessEngine.cpp1
-rw-r--r--Userland/Services/ChessEngine/main.cpp4
-rw-r--r--Userland/Services/DHCPClient/DHCPv4Client.cpp4
-rw-r--r--Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp4
-rw-r--r--Userland/Services/KeyboardPreferenceLoader/main.cpp4
-rw-r--r--Userland/Services/LaunchServer/Launcher.cpp8
-rw-r--r--Userland/Services/LookupServer/LookupServer.cpp4
-rw-r--r--Userland/Services/LookupServer/MulticastDNS.cpp4
-rw-r--r--Userland/Services/NetworkServer/main.cpp1
-rw-r--r--Userland/Services/SystemServer/Service.cpp4
-rw-r--r--Userland/Services/SystemServer/main.cpp6
-rw-r--r--Userland/Services/TelnetServer/main.cpp2
-rw-r--r--Userland/Services/WebContent/main.cpp4
-rw-r--r--Userland/Services/WebServer/Client.cpp10
-rw-r--r--Userland/Services/WebServer/main.cpp6
-rw-r--r--Userland/Services/WindowServer/KeymapSwitcher.cpp4
-rw-r--r--Userland/Services/WindowServer/main.cpp4
-rw-r--r--Userland/Shell/AST.cpp6
-rw-r--r--Userland/Shell/Builtin.cpp10
-rw-r--r--Userland/Shell/Shell.cpp16
-rw-r--r--Userland/Shell/main.cpp6
-rw-r--r--Userland/Utilities/abench.cpp4
-rw-r--r--Userland/Utilities/aplay.cpp4
-rw-r--r--Userland/Utilities/asctl.cpp1
-rw-r--r--Userland/Utilities/comm.cpp4
-rw-r--r--Userland/Utilities/cp.cpp24
-rw-r--r--Userland/Utilities/functrace.cpp1
-rw-r--r--Userland/Utilities/grep.cpp4
-rw-r--r--Userland/Utilities/groupdel.cpp1
-rw-r--r--Userland/Utilities/headless-browser.cpp6
-rw-r--r--Userland/Utilities/ini.cpp4
-rw-r--r--Userland/Utilities/install.cpp10
-rw-r--r--Userland/Utilities/ldd.cpp1
-rw-r--r--Userland/Utilities/ls.cpp12
-rw-r--r--Userland/Utilities/man.cpp1
-rw-r--r--Userland/Utilities/markdown-check.cpp6
-rw-r--r--Userland/Utilities/mv.cpp12
-rw-r--r--Userland/Utilities/open.cpp4
-rw-r--r--Userland/Utilities/pledge.cpp4
-rw-r--r--Userland/Utilities/pro.cpp4
-rw-r--r--Userland/Utilities/readelf.cpp1
-rw-r--r--Userland/Utilities/readlink.cpp4
-rw-r--r--Userland/Utilities/rm.cpp4
-rw-r--r--Userland/Utilities/run-tests.cpp6
-rw-r--r--Userland/Utilities/shot.cpp4
-rw-r--r--Userland/Utilities/sql.cpp4
-rw-r--r--Userland/Utilities/tar.cpp12
-rw-r--r--Userland/Utilities/test-imap.cpp4
-rw-r--r--Userland/Utilities/touch.cpp4
-rw-r--r--Userland/Utilities/unveil.cpp1
-rw-r--r--Userland/Utilities/unzip.cpp6
-rw-r--r--Userland/Utilities/userdel.cpp6
-rw-r--r--Userland/Utilities/usermod.cpp10
-rw-r--r--Userland/Utilities/wasm.cpp1
-rw-r--r--Userland/Utilities/watch.cpp4
-rw-r--r--Userland/Utilities/which.cpp4
-rw-r--r--Userland/Utilities/xml.cpp4
-rw-r--r--Userland/Utilities/zip.cpp10
193 files changed, 536 insertions, 556 deletions
diff --git a/Base/usr/share/man/man2/readlink.md b/Base/usr/share/man/man2/readlink.md
index 9a2fedb622..e4c7c24e62 100644
--- a/Base/usr/share/man/man2/readlink.md
+++ b/Base/usr/share/man/man2/readlink.md
@@ -26,12 +26,12 @@ and sets `errno` to describe the error.
## Notes
The underlying system call always returns the full size of the target path on
-success, not the number of bytes written. `Core::File::read_link()` makes use
+success, not the number of bytes written. `Core::DeprecatedFile::read_link()` makes use
of this to provide an alternative way to read links that doesn't require the
caller to pick a buffer size and allocate a buffer straight up.
Since it's essentially impossible to guess the right buffer size for reading
-links, it's strongly recommended that everything uses `Core::File::read_link()`
+links, it's strongly recommended that everything uses `Core::DeprecatedFile::read_link()`
instead.
## Examples
@@ -40,7 +40,7 @@ The following example demonstrates how one could implement an alternative
version of `getpid(2)` which reads the calling process ID from ProcFS:
```c++
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <unistd.h>
pid_t read_pid_using_readlink()
@@ -55,7 +55,7 @@ pid_t read_pid_using_readlink()
pid_t read_pid_using_core_file()
{
- auto target = Core::File::read_link("/proc/self");
+ auto target = Core::DeprecatedFile::read_link("/proc/self");
if (target.is_null())
return -1;
auto pid = target.to_uint();
diff --git a/Ladybird/AndroidPlatform.cpp b/Ladybird/AndroidPlatform.cpp
index c88a4dce3d..b1f8104314 100644
--- a/Ladybird/AndroidPlatform.cpp
+++ b/Ladybird/AndroidPlatform.cpp
@@ -13,7 +13,6 @@
#include <LibArchive/Tar.h>
#include <LibArchive/TarStream.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/FileStream.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
@@ -68,7 +67,7 @@ ErrorOr<void> extract_tar_archive(DeprecatedString archive_file, DeprecatedStrin
{
constexpr size_t buffer_size = 4096;
- auto file = TRY(Core::File::open(archive_file, Core::OpenMode::ReadOnly));
+ auto file = TRY(Core::DeprecatedFile::open(archive_file, Core::OpenMode::ReadOnly));
DeprecatedString old_pwd = TRY(Core::System::getcwd());
@@ -155,7 +154,7 @@ ErrorOr<void> extract_tar_archive(DeprecatedString archive_file, DeprecatedStrin
path = path.prepend(header.prefix());
DeprecatedString filename = get_override("path"sv).value_or(path.string());
- DeprecatedString absolute_path = Core::File::absolute_path(filename);
+ DeprecatedString absolute_path = Core::DeprecatedFile::absolute_path(filename);
auto parent_path = LexicalPath(absolute_path).parent();
switch (header.type_flag()) {
diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp
index 7c823644c7..12a534a1a6 100644
--- a/Ladybird/Utilities.cpp
+++ b/Ladybird/Utilities.cpp
@@ -9,7 +9,7 @@
#include "Utilities.h"
#include <AK/LexicalPath.h>
#include <AK/Platform.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <QCoreApplication>
DeprecatedString s_serenity_resource_root;
@@ -43,7 +43,7 @@ void platform_init()
auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME");
VERIFY(home);
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
- if (Core::File::is_directory(home_lagom))
+ if (Core::DeprecatedFile::is_directory(home_lagom))
return home_lagom;
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
return LexicalPath(app_dir).parent().append("share"sv).string();
diff --git a/Ladybird/WebContent/main.cpp b/Ladybird/WebContent/main.cpp
index 31aef09d75..0a68d2ed28 100644
--- a/Ladybird/WebContent/main.cpp
+++ b/Ladybird/WebContent/main.cpp
@@ -15,7 +15,6 @@
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/LocalServer.h>
#include <LibCore/System.h>
#include <LibCore/SystemServerTakeover.h>
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp
index d6d9c7ef46..690b1c0d72 100644
--- a/Ladybird/WebContentView.cpp
+++ b/Ladybird/WebContentView.cpp
@@ -24,7 +24,6 @@
#include <Kernel/API/KeyCode.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/IODevice.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
diff --git a/Ladybird/main.cpp b/Ladybird/main.cpp
index b6fa18b614..f29490a050 100644
--- a/Ladybird/main.cpp
+++ b/Ladybird/main.cpp
@@ -13,8 +13,8 @@
#include <Browser/CookieJar.h>
#include <Browser/Database.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibGfx/Font/FontDatabase.h>
@@ -79,8 +79,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto get_formatted_url = [&](StringView const& raw_url) -> URL {
URL url = raw_url;
- if (Core::File::exists(raw_url))
- url = URL::create_with_file_scheme(Core::File::real_path_for(raw_url));
+ if (Core::DeprecatedFile::exists(raw_url))
+ url = URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(raw_url));
else if (!url.is_valid())
url = DeprecatedString::formatted("http://{}", raw_url);
return url;
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp
index e7b2880cb4..f2e0249bcf 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp
@@ -19,8 +19,8 @@
#include <AK/SourceGenerator.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
@@ -921,7 +921,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString bcp47_path, DeprecatedSt
LexicalPath core_supplemental_path(core_path);
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
- VERIFY(Core::File::is_directory(core_supplemental_path.string()));
+ VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
TRY(parse_core_aliases(core_supplemental_path.string(), cldr));
TRY(parse_likely_subtags(core_supplemental_path.string(), cldr));
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp
index 879f85fd92..f9c35fae1b 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp
@@ -23,8 +23,8 @@
#include <AK/Traits.h>
#include <AK/Utf8View.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
#include <LibLocale/Locale.h>
@@ -704,7 +704,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
- VERIFY(Core::File::is_directory(core_supplemental_path.string()));
+ VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
TRY(parse_number_system_digits(core_supplemental_path.string(), cldr));
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
index ebbf19492d..d13b5f3753 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp
@@ -14,7 +14,7 @@
#include <AK/StringBuilder.h>
#include <AK/Variant.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibLocale/PluralRules.h>
@@ -398,7 +398,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
- VERIFY(Core::File::is_directory(core_supplemental_path.string()));
+ VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr<DeprecatedString> {
auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path)));
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
index a3f3e6692b..984f44396c 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp
@@ -11,8 +11,8 @@
#include <AK/StringUtils.h>
#include <AK/Types.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibUnicode/Emoji.h>
@@ -46,7 +46,7 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, Emoji& emoj
}
auto path = DeprecatedString::formatted("{}/{}.png", emoji_resource_path, builder.to_deprecated_string());
- if (Core::File::exists(path))
+ if (Core::DeprecatedFile::exists(path))
emoji.image_path = move(path);
}
@@ -340,7 +340,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
auto emoji_test_file = TRY(open_file(emoji_test_path, Core::Stream::OpenMode::Read));
- VERIFY(!emoji_resource_path.is_empty() && Core::File::exists(emoji_resource_path));
+ VERIFY(!emoji_resource_path.is_empty() && Core::DeprecatedFile::exists(emoji_resource_path));
EmojiData emoji_data {};
TRY(parse_emoji_test_data(*emoji_test_file, emoji_data));
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h
index 12f8e741f8..c83378f6f9 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h
+++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h
@@ -20,7 +20,6 @@
#include <AK/Traits.h>
#include <AK/Vector.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibLocale/Locale.h>
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp
index 5dda94b574..ec07396c5f 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp
@@ -11,7 +11,6 @@
#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibIDL/IDLParser.h>
#include <LibIDL/Types.h>
diff --git a/Meta/Lagom/Tools/ConfigureComponents/main.cpp b/Meta/Lagom/Tools/ConfigureComponents/main.cpp
index 192717cddc..a184dd5405 100644
--- a/Meta/Lagom/Tools/ConfigureComponents/main.cpp
+++ b/Meta/Lagom/Tools/ConfigureComponents/main.cpp
@@ -12,7 +12,7 @@
#include <AK/StringView.h>
#include <AK/Vector.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <spawn.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
@@ -231,7 +231,7 @@ int main()
return 1;
}
- auto current_working_directory = Core::File::current_working_directory();
+ auto current_working_directory = Core::DeprecatedFile::current_working_directory();
if (current_working_directory.is_null())
return 1;
auto lexical_cwd = LexicalPath(current_working_directory);
@@ -241,7 +241,7 @@ int main()
return 1;
}
- if (!Core::File::exists("components.ini"sv)) {
+ if (!Core::DeprecatedFile::exists("components.ini"sv)) {
warnln("\e[31mError:\e[0m There is no 'components.ini' in the current working directory.");
warnln(" It can be generated by running CMake with 'cmake ../.. -G Ninja'");
return 1;
diff --git a/Meta/Lagom/Tools/IPCMagicLinter/main.cpp b/Meta/Lagom/Tools/IPCMagicLinter/main.cpp
index 5c482fc1fd..f48e01bc17 100644
--- a/Meta/Lagom/Tools/IPCMagicLinter/main.cpp
+++ b/Meta/Lagom/Tools/IPCMagicLinter/main.cpp
@@ -7,7 +7,7 @@
#include <AK/HashMap.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
// Exit code is bitwise-or of these values:
static constexpr auto EXIT_COLLISION = 0x1;
@@ -25,7 +25,7 @@ int main(int argc, char** argv)
bool had_errors = false;
for (int file_index = 1; file_index < argc; ++file_index) {
DeprecatedString filename(argv[file_index]);
- auto file_or_error = Core::File::open(filename, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(filename, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Error: Cannot open '{}': {}", filename, file_or_error.error());
had_errors = true;
diff --git a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch
index fd77cb1cda..50763e01ce 100644
--- a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch
+++ b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch
@@ -88,9 +88,9 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f
+}
+
+#include <AK/JsonArray.h>
++#include <LibCore/DeprecatedFile.h>
+#include <LibCore/ProcessStatisticsReader.h>
+#include <LibCore/Stream.h>
-+#include <LibCore/File.h>
+#include <stdio.h>
+#include <string.h>
+
@@ -108,11 +108,11 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f
+ })
+
+
-+static RefPtr<Core::File> proc_all;
++static RefPtr<Core::DeprecatedFile> proc_all;
+
+extern "C" {
+void os_initNative(JNIEnv *env, jclass clazz) {
-+ proc_all = MUST(Core::File::open("/sys/kernel/processes", Core::OpenMode::ReadOnly));
++ proc_all = MUST(Core::DeprecatedFile::open("/sys/kernel/processes", Core::OpenMode::ReadOnly));
+}
+
+jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
diff --git a/Tests/Kernel/TestKernelFilePermissions.cpp b/Tests/Kernel/TestKernelFilePermissions.cpp
index 00dbbabc5b..ec58a1f10a 100644
--- a/Tests/Kernel/TestKernelFilePermissions.cpp
+++ b/Tests/Kernel/TestKernelFilePermissions.cpp
@@ -5,7 +5,7 @@
*/
#include <AK/DeprecatedString.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/TestCase.h>
#include <fcntl.h>
#include <stdio.h>
@@ -81,7 +81,7 @@ TEST_CASE(test_change_file_location)
ftruncate(fd, 0);
EXPECT(fchmod(fd, 06755) != -1);
- auto suid_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto suid_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!suid_path_or_error.is_error());
auto suid_path = suid_path_or_error.release_value();
diff --git a/Tests/LibC/TestIo.cpp b/Tests/LibC/TestIo.cpp
index e121876d73..b7bcd58359 100644
--- a/Tests/LibC/TestIo.cpp
+++ b/Tests/LibC/TestIo.cpp
@@ -7,7 +7,7 @@
#include <AK/Assertions.h>
#include <AK/Types.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/TestCase.h>
#include <fcntl.h>
#include <stdio.h>
@@ -217,7 +217,7 @@ TEST_CASE(unlink_symlink)
perror("symlink");
}
- auto target_or_error = Core::File::read_link("/tmp/linky");
+ auto target_or_error = Core::DeprecatedFile::read_link("/tmp/linky");
EXPECT(!target_or_error.is_error());
auto target = target_or_error.release_value();
diff --git a/Tests/LibC/TestLibCMkTemp.cpp b/Tests/LibC/TestLibCMkTemp.cpp
index 34df15b145..9f7eedac6f 100644
--- a/Tests/LibC/TestLibCMkTemp.cpp
+++ b/Tests/LibC/TestLibCMkTemp.cpp
@@ -6,7 +6,7 @@
*/
#include <AK/DeprecatedString.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/TestCase.h>
#include <fcntl.h>
#include <stdio.h>
@@ -86,7 +86,7 @@ TEST_CASE(test_mkstemp_unique_filename)
auto fd = mkstemp(path);
EXPECT_NE(fd, -1);
- auto temp_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto temp_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!temp_path_or_error.is_error());
auto temp_path = temp_path_or_error.release_value();
@@ -107,7 +107,7 @@ TEST_CASE(test_mkstemp_unique_filename)
auto fd = mkstemp(path);
EXPECT(fd != -1);
- auto path2_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto path2_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!path2_or_error.is_error());
auto path2 = path2_or_error.release_value();
@@ -132,7 +132,7 @@ TEST_CASE(test_mkstemps_unique_filename)
auto fd = mkstemps(path, 6);
EXPECT_NE(fd, -1);
- auto temp_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto temp_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!temp_path_or_error.is_error());
auto temp_path = temp_path_or_error.release_value();
@@ -157,7 +157,7 @@ TEST_CASE(test_mkstemps_unique_filename)
auto fd = mkstemps(path, 6);
EXPECT(fd != -1);
- auto path2_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto path2_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!path2_or_error.is_error());
auto path2 = path2_or_error.release_value();
diff --git a/Tests/LibCore/TestLibCoreIODevice.cpp b/Tests/LibCore/TestLibCoreIODevice.cpp
index 4c4352fbea..025d5042db 100644
--- a/Tests/LibCore/TestLibCoreIODevice.cpp
+++ b/Tests/LibCore/TestLibCoreIODevice.cpp
@@ -4,14 +4,14 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/TestCase.h>
#include <unistd.h>
static bool files_have_same_contents(DeprecatedString filename1, DeprecatedString filename2)
{
- auto file1 = Core::File::open(filename1, Core::OpenMode::ReadOnly).value();
- auto file2 = Core::File::open(filename2, Core::OpenMode::ReadOnly).value();
+ auto file1 = Core::DeprecatedFile::open(filename1, Core::OpenMode::ReadOnly).value();
+ auto file2 = Core::DeprecatedFile::open(filename2, Core::OpenMode::ReadOnly).value();
auto contents1 = file1->read_all(), contents2 = file2->read_all();
return contents1 == contents2;
}
@@ -19,14 +19,14 @@ static bool files_have_same_contents(DeprecatedString filename1, DeprecatedStrin
TEST_CASE(file_readline)
{
auto path = "long_lines.txt";
- auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Failed to open {}: {}", path, file_or_error.error());
VERIFY_NOT_REACHED();
}
auto file = file_or_error.release_value();
auto output_path = "/tmp/output.txt";
- auto outfile_or_error = Core::File::open(output_path, Core::OpenMode::WriteOnly);
+ auto outfile_or_error = Core::DeprecatedFile::open(output_path, Core::OpenMode::WriteOnly);
auto outputfile = outfile_or_error.release_value();
while (file->can_read_line()) {
outputfile->write(file->read_line());
@@ -41,7 +41,7 @@ TEST_CASE(file_readline)
TEST_CASE(file_get_read_position)
{
const DeprecatedString path = "10kb.txt";
- auto file = Core::File::open(path, Core::OpenMode::ReadOnly).release_value();
+ auto file = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly).release_value();
const size_t step_size = 98;
for (size_t i = 0; i < 10240 - step_size; i += step_size) {
@@ -73,14 +73,14 @@ TEST_CASE(file_get_read_position)
TEST_CASE(file_lines_range)
{
auto path = "long_lines.txt";
- auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Failed to open {}: {}", path, file_or_error.error());
VERIFY_NOT_REACHED();
}
auto file = file_or_error.release_value();
auto output_path = "/tmp/output.txt";
- auto outfile_or_error = Core::File::open(output_path, Core::OpenMode::WriteOnly);
+ auto outfile_or_error = Core::DeprecatedFile::open(output_path, Core::OpenMode::WriteOnly);
auto outputfile = outfile_or_error.release_value();
for (auto line : file->lines()) {
outputfile->write(line);
diff --git a/Tests/LibELF/test-elf.cpp b/Tests/LibELF/test-elf.cpp
index 8b4331ad42..2cb187a6a3 100644
--- a/Tests/LibELF/test-elf.cpp
+++ b/Tests/LibELF/test-elf.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/TestCase.h>
#include <elf.h>
#include <fcntl.h>
@@ -58,7 +58,7 @@ TEST_CASE(test_interp_header_tiny_p_filesz)
int nwritten = write(fd, buffer, sizeof(buffer));
EXPECT(nwritten);
- auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!elf_path_or_error.is_error());
auto elf_path = elf_path_or_error.release_value();
@@ -115,7 +115,7 @@ TEST_CASE(test_interp_header_p_filesz_larger_than_p_memsz)
int nwritten = write(fd, buffer, sizeof(buffer));
EXPECT(nwritten);
- auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!elf_path_or_error.is_error());
auto elf_path = elf_path_or_error.release_value();
@@ -176,7 +176,7 @@ TEST_CASE(test_interp_header_p_filesz_plus_p_offset_overflow_p_memsz)
int nwritten = write(fd, buffer, sizeof(buffer));
EXPECT(nwritten);
- auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!elf_path_or_error.is_error());
auto elf_path = elf_path_or_error.release_value();
@@ -234,7 +234,7 @@ TEST_CASE(test_load_header_p_memsz_zero)
int nwritten = write(fd, buffer, sizeof(buffer));
EXPECT(nwritten);
- auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!elf_path_or_error.is_error());
auto elf_path = elf_path_or_error.release_value();
@@ -292,7 +292,7 @@ TEST_CASE(test_load_header_p_memsz_not_equal_to_p_align)
int nwritten = write(fd, buffer, sizeof(buffer));
EXPECT(nwritten);
- auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto elf_path_or_error = Core::DeprecatedFile::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd));
EXPECT(!elf_path_or_error.is_error());
auto elf_path = elf_path_or_error.release_value();
diff --git a/Tests/LibJS/test-test262.cpp b/Tests/LibJS/test-test262.cpp
index 0adcc607c0..075197bbb7 100644
--- a/Tests/LibJS/test-test262.cpp
+++ b/Tests/LibJS/test-test262.cpp
@@ -13,7 +13,7 @@
#include <AK/QuickSort.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Process.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
@@ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Normalize the path to ensure filenames are consistent
Vector<DeprecatedString> paths;
- if (!Core::File::is_directory(test_directory)) {
+ if (!Core::DeprecatedFile::is_directory(test_directory)) {
paths.append(test_directory);
} else {
Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) {
diff --git a/Tests/LibTLS/TestTLSHandshake.cpp b/Tests/LibTLS/TestTLSHandshake.cpp
index 8f0a96e7cb..1878b6a425 100644
--- a/Tests/LibTLS/TestTLSHandshake.cpp
+++ b/Tests/LibTLS/TestTLSHandshake.cpp
@@ -6,8 +6,8 @@
#include <AK/Base64.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCrypto/ASN1/ASN1.h>
#include <LibTLS/TLSv12.h>
#include <LibTest/TestCase.h>
@@ -27,11 +27,11 @@ DeprecatedString locate_ca_certs_file();
DeprecatedString locate_ca_certs_file()
{
- if (Core::File::exists(ca_certs_file)) {
+ if (Core::DeprecatedFile::exists(ca_certs_file)) {
return ca_certs_file;
}
auto on_target_path = DeprecatedString("/etc/ca_certs.ini");
- if (Core::File::exists(on_target_path)) {
+ if (Core::DeprecatedFile::exists(on_target_path)) {
return on_target_path;
}
return "";
diff --git a/Userland/Applications/3DFileViewer/MeshLoader.h b/Userland/Applications/3DFileViewer/MeshLoader.h
index 0c33507962..3e1f1f0680 100644
--- a/Userland/Applications/3DFileViewer/MeshLoader.h
+++ b/Userland/Applications/3DFileViewer/MeshLoader.h
@@ -8,7 +8,7 @@
#pragma once
#include <AK/DeprecatedString.h>
-#include <LibCore/File.h>
+#include <LibCore/Forward.h>
#include "Common.h"
#include "Mesh.h"
@@ -18,5 +18,5 @@ public:
MeshLoader() = default;
virtual ~MeshLoader() = default;
- virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) = 0;
+ virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) = 0;
};
diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp
index e5b7f5b9d1..d6231abc92 100644
--- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp
+++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp
@@ -8,7 +8,7 @@
#include "WavefrontOBJLoader.h"
#include <AK/FixedArray.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <stdlib.h>
static inline GLuint get_index_value(StringView& representation)
@@ -16,7 +16,7 @@ static inline GLuint get_index_value(StringView& representation)
return representation.to_uint().value_or(1) - 1;
}
-ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::File& file)
+ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::DeprecatedFile& file)
{
Vector<Vertex> vertices;
Vector<Vertex> normals;
diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h
index 77e197e43d..1429547e6c 100644
--- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h
+++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h
@@ -18,5 +18,5 @@ public:
WavefrontOBJLoader() = default;
~WavefrontOBJLoader() override = default;
- ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) override;
+ ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) override;
};
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp
index 27442da718..e74a2ea760 100644
--- a/Userland/Applications/3DFileViewer/main.cpp
+++ b/Userland/Applications/3DFileViewer/main.cpp
@@ -6,7 +6,6 @@
*/
#include <LibCore/ElapsedTimer.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGL/GL/gl.h>
@@ -34,7 +33,7 @@ class GLContextWidget final : public GUI::Frame {
public:
bool load_path(DeprecatedString const& fname);
- bool load_file(Core::File& file);
+ bool load_file(Core::DeprecatedFile& file);
void toggle_rotate_x() { m_rotate_x = !m_rotate_x; }
void toggle_rotate_y() { m_rotate_y = !m_rotate_y; }
void toggle_rotate_z() { m_rotate_z = !m_rotate_z; }
@@ -291,7 +290,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
bool GLContextWidget::load_path(DeprecatedString const& filename)
{
- auto file = Core::File::construct(filename);
+ auto file = Core::DeprecatedFile::construct(filename);
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
@@ -301,7 +300,7 @@ bool GLContextWidget::load_path(DeprecatedString const& filename)
return load_file(file);
}
-bool GLContextWidget::load_file(Core::File& file)
+bool GLContextWidget::load_file(Core::DeprecatedFile& file)
{
auto const& filename = file.filename();
if (!filename.ends_with(".obj"sv)) {
@@ -330,11 +329,11 @@ bool GLContextWidget::load_file(Core::File& file)
builder.append(filename.split('.').at(0));
builder.append(".bmp"sv);
- DeprecatedString texture_path = Core::File::absolute_path(builder.string_view());
+ DeprecatedString texture_path = Core::DeprecatedFile::absolute_path(builder.string_view());
// Attempt to open the texture file from disk
RefPtr<Gfx::Bitmap> texture_image;
- if (Core::File::exists(texture_path)) {
+ if (Core::DeprecatedFile::exists(texture_path)) {
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path);
if (!bitmap_or_error.is_error())
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
@@ -403,7 +402,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = response.value();
if (widget->load_file(*file)) {
- auto canonical_path = Core::File::absolute_path(file->filename());
+ auto canonical_path = Core::DeprecatedFile::absolute_path(file->filename());
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
}
}));
@@ -592,7 +591,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj";
if (widget->load_path(filename)) {
- auto canonical_path = Core::File::absolute_path(filename);
+ auto canonical_path = Core::DeprecatedFile::absolute_path(filename);
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
}
diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp
index bfdcb66d8a..97ca9b3c17 100644
--- a/Userland/Applications/Assistant/Providers.cpp
+++ b/Userland/Applications/Assistant/Providers.cpp
@@ -10,7 +10,6 @@
#include <AK/URL.h>
#include <LibCore/DirIterator.h>
#include <LibCore/ElapsedTimer.h>
-#include <LibCore/File.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
@@ -23,6 +22,7 @@
#include <fcntl.h>
#include <serenity.h>
#include <spawn.h>
+#include <sys/stat.h>
#include <unistd.h>
namespace Assistant {
diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp
index 05477647d9..b094e44e0f 100644
--- a/Userland/Applications/Browser/main.cpp
+++ b/Userland/Applications/Browser/main.cpp
@@ -14,7 +14,7 @@
#include <Applications/Browser/WindowActions.h>
#include <LibConfig/Client.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/FileWatcher.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
@@ -131,8 +131,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto url_from_argument_string = [](DeprecatedString const& string) -> URL {
- if (Core::File::exists(string)) {
- return URL::create_with_file_scheme(Core::File::real_path_for(string));
+ if (Core::DeprecatedFile::exists(string)) {
+ return URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(string));
}
return Browser::url_from_user_input(string);
};
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp
index f3c6a46b2a..06410e508f 100644
--- a/Userland/Applications/CrashReporter/main.cpp
+++ b/Userland/Applications/CrashReporter/main.cpp
@@ -12,7 +12,6 @@
#include <AK/URL.h>
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibCoredump/Backtrace.h>
#include <LibCoredump/Reader.h>
@@ -131,7 +130,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
static void unlink_coredump(StringView coredump_path)
{
- if (Core::File::remove(coredump_path, Core::File::RecursionMode::Disallowed).is_error())
+ if (Core::DeprecatedFile::remove(coredump_path, Core::DeprecatedFile::RecursionMode::Disallowed).is_error())
dbgln("Failed deleting coredump file");
}
diff --git a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
index 1be525239e..35abe94a03 100644
--- a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
+++ b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
@@ -6,7 +6,6 @@
#include "ThemePreviewWidget.h"
#include <AK/Array.h>
-#include <LibCore/File.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Painter.h>
#include <LibGfx/StylePainter.h>
diff --git a/Userland/Applications/Escalator/main.cpp b/Userland/Applications/Escalator/main.cpp
index c84b1eb9f7..7bcce41429 100644
--- a/Userland/Applications/Escalator/main.cpp
+++ b/Userland/Applications/Escalator/main.cpp
@@ -9,7 +9,7 @@
#include <AK/DeprecatedString.h>
#include <LibCore/Account.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Desktop.h>
@@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
- auto executable_path = Core::File::resolve_executable_from_environment(command[0]);
+ auto executable_path = Core::DeprecatedFile::resolve_executable_from_environment(command[0]);
if (!executable_path.has_value()) {
GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0]));
return 127;
diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp
index 0cd9e3a286..3d7f684dc0 100644
--- a/Userland/Applications/FileManager/DirectoryView.cpp
+++ b/Userland/Applications/FileManager/DirectoryView.cpp
@@ -11,7 +11,7 @@
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <LibConfig/Client.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/FileIconProvider.h>
@@ -204,7 +204,7 @@ void DirectoryView::setup_model()
while (model_root.string() != "/") {
model_root = model_root.parent();
- if (Core::File::is_directory(model_root.string()))
+ if (Core::DeprecatedFile::is_directory(model_root.string()))
break;
}
@@ -405,8 +405,8 @@ void DirectoryView::add_path_to_history(DeprecatedString path)
bool DirectoryView::open(DeprecatedString const& path)
{
- auto real_path = Core::File::real_path_for(path);
- if (real_path.is_null() || !Core::File::is_directory(path))
+ auto real_path = Core::DeprecatedFile::real_path_for(path);
+ if (real_path.is_null() || !Core::DeprecatedFile::is_directory(path))
return false;
if (chdir(real_path.characters()) < 0) {
@@ -555,7 +555,7 @@ bool DirectoryView::can_modify_current_selection()
// FIXME: remove once Clang formats this properly.
// clang-format off
return selections.first_matching([&](auto& index) {
- return Core::File::can_delete_or_move(node(index).full_path());
+ return Core::DeprecatedFile::can_delete_or_move(node(index).full_path());
}).has_value();
// clang-format on
}
diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
index ed4f1a764d..a185c4e58e 100644
--- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
+++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
@@ -8,7 +8,6 @@
#include "FileOperationProgressWidget.h"
#include "FileUtils.h"
#include <Applications/FileManager/FileOperationProgressGML.h>
-#include <LibCore/File.h>
#include <LibCore/Notifier.h>
#include <LibGUI/Button.h>
#include <LibGUI/ImageWidget.h>
diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp
index d9daae3f71..c25b0457a8 100644
--- a/Userland/Applications/FileManager/FileUtils.cpp
+++ b/Userland/Applications/FileManager/FileUtils.cpp
@@ -8,7 +8,7 @@
#include "FileUtils.h"
#include "FileOperationProgressWidget.h"
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
@@ -125,7 +125,7 @@ ErrorOr<bool> handle_drop(GUI::DropEvent const& event, DeprecatedString const& d
auto const target = LexicalPath::canonicalized_path(destination);
- if (!Core::File::is_directory(target))
+ if (!Core::DeprecatedFile::is_directory(target))
return has_accepted_drop;
Vector<DeprecatedString> paths_to_copy;
diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp
index 75632ab82d..6e0a537cd6 100644
--- a/Userland/Applications/FileManager/PropertiesWindow.cpp
+++ b/Userland/Applications/FileManager/PropertiesWindow.cpp
@@ -10,6 +10,7 @@
#include <AK/NumberFormat.h>
#include <Applications/FileManager/DirectoryView.h>
#include <Applications/FileManager/PropertiesWindowGeneralTabGML.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
@@ -102,7 +103,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
type->set_text(get_description(m_mode));
if (S_ISLNK(m_mode)) {
- auto link_destination_or_error = Core::File::read_link(m_path);
+ auto link_destination_or_error = Core::DeprecatedFile::read_link(m_path);
if (link_destination_or_error.is_error()) {
perror("readlink");
} else {
@@ -214,7 +215,7 @@ bool PropertiesWindow::apply_changes()
DeprecatedString new_name = m_name_box->text();
DeprecatedString new_file = make_full_path(new_name).characters();
- if (Core::File::exists(new_file)) {
+ if (Core::DeprecatedFile::exists(new_file)) {
GUI::MessageBox::show(this, DeprecatedString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error);
return false;
}
diff --git a/Userland/Applications/FileManager/PropertiesWindow.h b/Userland/Applications/FileManager/PropertiesWindow.h
index 030342d074..579c5e42f7 100644
--- a/Userland/Applications/FileManager/PropertiesWindow.h
+++ b/Userland/Applications/FileManager/PropertiesWindow.h
@@ -8,7 +8,6 @@
#pragma once
#include <AK/Queue.h>
-#include <LibCore/File.h>
#include <LibGUI/Button.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/FileSystemModel.h>
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index 307fd55fe8..9cd52d2656 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -19,7 +19,7 @@
#include <LibConfig/Client.h>
#include <LibConfig/Listener.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
@@ -107,14 +107,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!initial_location.is_empty()) {
if (!ignore_path_resolution)
- initial_location = Core::File::real_path_for(initial_location);
+ initial_location = Core::DeprecatedFile::real_path_for(initial_location);
- if (!Core::File::is_directory(initial_location))
+ if (!Core::DeprecatedFile::is_directory(initial_location))
is_selection_mode = true;
}
if (initial_location.is_empty())
- initial_location = Core::File::current_working_directory();
+ initial_location = Core::DeprecatedFile::current_working_directory();
if (initial_location.is_empty())
initial_location = Core::StandardPaths::home_directory();
@@ -188,7 +188,7 @@ void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Wi
{
auto path = selected_file_paths.first();
auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
- if (auto result = Core::File::link_file(destination, path); result.is_error()) {
+ if (auto result = Core::DeprecatedFile::link_file(destination, path); result.is_error()) {
GUI::MessageBox::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
GUI::MessageBox::Type::Error);
}
@@ -456,7 +456,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
- if (Core::File::is_directory(path))
+ if (Core::DeprecatedFile::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
});
@@ -469,7 +469,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
- if (Core::File::is_directory(path)) {
+ if (Core::DeprecatedFile::is_directory(path)) {
spawn_terminal(path);
}
}
@@ -814,7 +814,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
- if (Core::File::is_directory(path))
+ if (Core::DeprecatedFile::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
},
@@ -833,7 +833,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
- if (Core::File::is_directory(path)) {
+ if (Core::DeprecatedFile::is_directory(path)) {
spawn_terminal(path);
}
}
@@ -1090,7 +1090,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
if (!segment_index.has_value())
return;
auto selected_path = breadcrumbbar.segment_data(*segment_index);
- if (Core::File::is_directory(selected_path)) {
+ if (Core::DeprecatedFile::is_directory(selected_path)) {
directory_view->open(selected_path);
} else {
dbgln("Breadcrumb path '{}' doesn't exist", selected_path);
@@ -1121,7 +1121,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
// If the path change was because the directory we were in was deleted,
// remove the breadcrumbs for it.
if ((new_segment_index + 1 < breadcrumbbar.segment_count())
- && !Core::File::is_directory(breadcrumbbar.segment_data(new_segment_index + 1))) {
+ && !Core::DeprecatedFile::is_directory(breadcrumbbar.segment_data(new_segment_index + 1))) {
breadcrumbbar.remove_end_segments(new_segment_index + 1);
}
} else {
diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp
index 65453b39e4..be58ec69f1 100644
--- a/Userland/Applications/Help/MainWidget.cpp
+++ b/Userland/Applications/Help/MainWidget.cpp
@@ -14,7 +14,6 @@
#include <AK/URL.h>
#include <Applications/Help/HelpWindowGML.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>
diff --git a/Userland/Applications/HexEditor/HexDocument.h b/Userland/Applications/HexEditor/HexDocument.h
index 6a5f7943cc..d5e46a4f87 100644
--- a/Userland/Applications/HexEditor/HexDocument.h
+++ b/Userland/Applications/HexEditor/HexDocument.h
@@ -6,11 +6,13 @@
#pragma once
+#include <AK/HashMap.h>
+#include <AK/NonnullOwnPtr.h>
#include <AK/StringView.h>
#include <AK/Time.h>
#include <AK/Types.h>
#include <AK/WeakPtr.h>
-#include <LibCore/File.h>
+#include <LibCore/Forward.h>
#include <LibGUI/Command.h>
constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400);
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp
index 52f7a454bb..6bdfd5d05b 100644
--- a/Userland/Applications/ImageViewer/ViewWidget.cpp
+++ b/Userland/Applications/ImageViewer/ViewWidget.cpp
@@ -11,8 +11,8 @@
#include "ViewWidget.h"
#include <AK/LexicalPath.h>
#include <AK/StringBuilder.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/Timer.h>
@@ -195,7 +195,7 @@ void ViewWidget::load_from_file(DeprecatedString const& path)
m_timer->stop();
}
- m_path = Core::File::real_path_for(path);
+ m_path = Core::DeprecatedFile::real_path_for(path);
reset_view();
}
diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
index d368ec0e7b..83624bef9f 100644
--- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
+++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp
@@ -12,8 +12,8 @@
#include <Applications/KeyboardSettings/KeyboardWidgetGML.h>
#include <Applications/KeyboardSettings/KeymapDialogGML.h>
#include <LibConfig/Client.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/Dialog.h>
@@ -153,7 +153,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
{
load_from_gml(keyboard_widget_gml).release_value_but_fixme_should_propagate_errors();
- auto proc_keymap = Core::File::construct("/sys/kernel/keymap");
+ auto proc_keymap = Core::DeprecatedFile::construct("/sys/kernel/keymap");
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();
diff --git a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
index 5678029ca0..a57685df36 100644
--- a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
+++ b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
@@ -11,7 +11,6 @@
#include <AK/JsonParser.h>
#include <Applications/NetworkSettings/NetworkSettingsGML.h>
#include <LibCore/Command.h>
-#include <LibCore/File.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ItemListModel.h>
diff --git a/Userland/Applications/NetworkSettings/main.cpp b/Userland/Applications/NetworkSettings/main.cpp
index 22354b10bb..63270f49cf 100644
--- a/Userland/Applications/NetworkSettings/main.cpp
+++ b/Userland/Applications/NetworkSettings/main.cpp
@@ -9,7 +9,6 @@
#include <LibGUI/MessageBox.h>
#include <unistd.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index 1f4d91b376..b98629302e 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -12,7 +12,6 @@
#include <AK/HashMap.h>
#include <AK/HashTable.h>
#include <AK/Variant.h>
-#include <LibCore/File.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
diff --git a/Userland/Applications/PartitionEditor/PartitionModel.cpp b/Userland/Applications/PartitionEditor/PartitionModel.cpp
index f6cf48cf49..73f7da320e 100644
--- a/Userland/Applications/PartitionEditor/PartitionModel.cpp
+++ b/Userland/Applications/PartitionEditor/PartitionModel.cpp
@@ -6,6 +6,7 @@
#include <AK/NumberFormat.h>
#include <Applications/PartitionEditor/PartitionModel.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibPartition/EBRPartitionTable.h>
#include <LibPartition/GUIDPartitionTable.h>
#include <LibPartition/MBRPartitionTable.h>
@@ -62,7 +63,7 @@ GUI::Variant PartitionModel::data(GUI::ModelIndex const& index, GUI::ModelRole r
ErrorOr<void> PartitionModel::set_device_path(DeprecatedString const& path)
{
- auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
+ auto file = TRY(Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly));
auto mbr_table_or_error = Partition::MBRPartitionTable::try_to_initialize(file);
if (!mbr_table_or_error.is_error()) {
diff --git a/Userland/Applications/PartitionEditor/main.cpp b/Userland/Applications/PartitionEditor/main.cpp
index 8bf735f369..9c05c24ccb 100644
--- a/Userland/Applications/PartitionEditor/main.cpp
+++ b/Userland/Applications/PartitionEditor/main.cpp
@@ -6,6 +6,7 @@
#include <Applications/PartitionEditor/PartitionEditorWindowGML.h>
#include <Applications/PartitionEditor/PartitionModel.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
@@ -22,7 +23,7 @@ static Vector<DeprecatedString> get_device_paths()
Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir);
while (iterator.has_next()) {
auto path = iterator.next_full_path();
- if (Core::File::is_block_device(path))
+ if (Core::DeprecatedFile::is_block_device(path))
device_paths.append(path);
}
return device_paths;
diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp
index d961eb9894..4c86e9df8e 100644
--- a/Userland/Applications/Run/RunWindow.cpp
+++ b/Userland/Applications/Run/RunWindow.cpp
@@ -9,7 +9,7 @@
#include <AK/LexicalPath.h>
#include <AK/URL.h>
#include <Applications/Run/RunGML.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
#include <LibDesktop/Launcher.h>
@@ -143,9 +143,9 @@ bool RunWindow::run_via_launch(DeprecatedString const& run_input)
auto url = URL::create_with_url_or_path(run_input);
if (url.scheme() == "file") {
- auto real_path = Core::File::real_path_for(url.path());
+ auto real_path = Core::DeprecatedFile::real_path_for(url.path());
if (real_path.is_null()) {
- // errno *should* be preserved from Core::File::real_path_for().
+ // errno *should* be preserved from Core::DeprecatedFile::real_path_for().
warnln("Failed to launch '{}': {}", url.path(), strerror(errno));
return false;
}
diff --git a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
index 8d3cdbb693..3eeda05ed7 100644
--- a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
+++ b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp
@@ -8,7 +8,7 @@
#include "AlbumCoverVisualizationWidget.h"
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Rect.h>
@@ -48,7 +48,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> AlbumCoverVisualizationWidget::get_album_cov
static constexpr auto possible_cover_filenames = Array { "cover.png"sv, "cover.jpg"sv };
for (auto& it : possible_cover_filenames) {
LexicalPath cover_path = LexicalPath::join(directory, it);
- if (Core::File::exists(cover_path.string()))
+ if (Core::DeprecatedFile::exists(cover_path.string()))
return Gfx::Bitmap::load_from_file(cover_path.string());
}
diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp
index 87c3684e48..af254a0480 100644
--- a/Userland/Applications/SoundPlayer/Player.cpp
+++ b/Userland/Applications/SoundPlayer/Player.cpp
@@ -7,7 +7,7 @@
#include "Player.h"
#include <LibAudio/FlacLoader.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
Player::Player(Audio::ConnectionToServer& audio_client_connection)
: m_audio_client_connection(audio_client_connection)
@@ -44,7 +44,7 @@ void Player::play_file_path(DeprecatedString const& path)
if (path.is_null())
return;
- if (!Core::File::exists(path)) {
+ if (!Core::DeprecatedFile::exists(path)) {
audio_load_error(path, "File does not exist"sv);
return;
}
diff --git a/Userland/Applications/SoundPlayer/Playlist.cpp b/Userland/Applications/SoundPlayer/Playlist.cpp
index 991f368040..63bd4e9774 100644
--- a/Userland/Applications/SoundPlayer/Playlist.cpp
+++ b/Userland/Applications/SoundPlayer/Playlist.cpp
@@ -10,7 +10,7 @@
#include <AK/LexicalPath.h>
#include <AK/Random.h>
#include <LibAudio/Loader.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibGUI/MessageBox.h>
bool Playlist::load(StringView path)
@@ -39,11 +39,11 @@ void Playlist::try_fill_missing_info(Vector<M3UEntry>& entries, StringView path)
entry.path = DeprecatedString::formatted("{}/{}", playlist_path.dirname(), entry.path);
if (!entry.extended_info->file_size_in_bytes.has_value()) {
- auto size = Core::File::size(entry.path);
+ auto size = Core::DeprecatedFile::size(entry.path);
if (size.is_error())
continue;
entry.extended_info->file_size_in_bytes = size.value();
- } else if (!Core::File::exists(entry.path)) {
+ } else if (!Core::DeprecatedFile::exists(entry.path)) {
to_delete.append(&entry);
continue;
}
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index 856746c9b5..f7a584cd26 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -11,7 +11,7 @@
#include <AK/String.h>
#include <AK/URL.h>
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
while (try_again) {
try_again = false;
- auto deletion_result = Core::File::remove(selected_node_path, Core::File::RecursionMode::Allowed);
+ auto deletion_result = Core::DeprecatedFile::remove(selected_node_path, Core::DeprecatedFile::RecursionMode::Allowed);
if (deletion_result.is_error()) {
auto retry_message_result = GUI::MessageBox::show(window,
DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?",
@@ -164,8 +164,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
DeprecatedString selected_node_path = get_absolute_path_to_selected_node(tree_map_widget);
if (selected_node_path.is_empty())
return;
- delete_action->set_enabled(Core::File::can_delete_or_move(selected_node_path));
- if (Core::File::is_directory(selected_node_path)) {
+ delete_action->set_enabled(Core::DeprecatedFile::can_delete_or_move(selected_node_path));
+ if (Core::DeprecatedFile::is_directory(selected_node_path)) {
open_folder_action->set_visible(true);
open_containing_folder_action->set_visible(false);
} else {
diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp
index a22c32bfe4..f27cfdf8b2 100644
--- a/Userland/Applications/Spreadsheet/ImportDialog.cpp
+++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp
@@ -10,7 +10,6 @@
#include <AK/LexicalPath.h>
#include <Applications/Spreadsheet/CSVImportGML.h>
#include <Applications/Spreadsheet/FormatSelectionPageGML.h>
-#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>
diff --git a/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp b/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp
index 82a0df5ab3..b0c93e2ed5 100644
--- a/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp
+++ b/Userland/Applications/Spreadsheet/Readers/Test/TestXSV.cpp
@@ -9,7 +9,6 @@
#include "../CSV.h"
#include "../XSV.h"
#include <AK/ByteBuffer.h>
-#include <LibCore/File.h>
#include <string.h>
TEST_CASE(should_parse_valid_data)
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
index 3893e3988e..94b12d07f0 100644
--- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
@@ -16,7 +16,7 @@
#include <AK/ScopeGuard.h>
#include <AK/TemporaryChange.h>
#include <AK/URL.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Parser.h>
#include <LibJS/Runtime/AbstractOperations.h>
@@ -49,7 +49,7 @@ Sheet::Sheet(Workbook& workbook)
// Sadly, these have to be evaluated once per sheet.
constexpr auto runtime_file_path = "/res/js/Spreadsheet/runtime.js"sv;
- auto file_or_error = Core::File::open(runtime_file_path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(runtime_file_path, Core::OpenMode::ReadOnly);
if (!file_or_error.is_error()) {
auto buffer = file_or_error.value()->read_all();
auto script_or_error = JS::Script::parse(buffer, interpreter().realm(), runtime_file_path);
diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp
index 73bfcab70f..31d1dbafed 100644
--- a/Userland/Applications/Spreadsheet/main.cpp
+++ b/Userland/Applications/Spreadsheet/main.cpp
@@ -10,7 +10,6 @@
#include <AK/ScopeGuard.h>
#include <AK/Try.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
@@ -34,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
if (filename) {
- if (!Core::File::exists({ filename, strlen(filename) }) || Core::File::is_directory(filename)) {
+ if (!Core::DeprecatedFile::exists({ filename, strlen(filename) }) || Core::DeprecatedFile::is_directory(filename)) {
warnln("File does not exist or is a directory: {}", filename);
return 1;
}
diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
index 85b2727c14..5c952bae9b 100644
--- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
@@ -9,7 +9,7 @@
#include "GraphWidget.h"
#include <AK/JsonObject.h>
#include <AK/NumberFormat.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Object.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Label.h>
@@ -104,7 +104,7 @@ static inline u64 page_count_to_bytes(size_t count)
void MemoryStatsWidget::refresh()
{
- auto proc_memstat = Core::File::construct("/sys/kernel/memstat");
+ auto proc_memstat = Core::DeprecatedFile::construct("/sys/kernel/memstat");
if (!proc_memstat->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp
index 716ad23c1c..f32d84ad25 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp
@@ -10,7 +10,7 @@
#include <AK/JsonValue.h>
#include <AK/NonnullRefPtr.h>
#include <AK/NumberFormat.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/ProcessStatisticsReader.h>
#include <LibCore/Stream.h>
#include <LibGUI/FileIconProvider.h>
@@ -32,7 +32,7 @@ ProcessModel::ProcessModel()
VERIFY(!s_the);
s_the = this;
- auto file = Core::File::construct("/sys/kernel/cpuinfo");
+ auto file = Core::DeprecatedFile::construct("/sys/kernel/cpuinfo");
if (file->open(Core::OpenMode::ReadOnly)) {
auto buffer = file->read_all();
auto json = JsonValue::from_string({ buffer });
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h
index 9822ffbccc..c9100de39f 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.h
+++ b/Userland/Applications/SystemMonitor/ProcessModel.h
@@ -245,7 +245,7 @@ private:
HashMap<int, NonnullRefPtr<Thread>> m_threads;
NonnullOwnPtrVector<Process> m_processes;
NonnullOwnPtrVector<CpuInfo> m_cpus;
- RefPtr<Core::File> m_proc_all;
+ RefPtr<Core::DeprecatedFile> m_proc_all;
GUI::Icon m_kernel_process_icon;
u64 m_total_time_scheduled { 0 };
u64 m_total_time_scheduled_kernel { 0 };
diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp
index a2e5a591b0..07da8ba674 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -10,8 +10,8 @@
#include <LibConfig/Client.h>
#include <LibConfig/Listener.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>
diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
index 9d1e901402..6f5c559568 100644
--- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
+++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
@@ -12,7 +12,6 @@
#include <Applications/TerminalSettings/TerminalSettingsViewGML.h>
#include <LibConfig/Client.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/Button.h>
#include <LibGUI/CheckBox.h>
diff --git a/Userland/Applications/TextEditor/FileArgument.cpp b/Userland/Applications/TextEditor/FileArgument.cpp
index 590c7fc985..a507e1258c 100644
--- a/Userland/Applications/TextEditor/FileArgument.cpp
+++ b/Userland/Applications/TextEditor/FileArgument.cpp
@@ -6,7 +6,6 @@
*/
#include "FileArgument.h"
-#include <LibCore/File.h>
#include <LibRegex/Regex.h>
namespace TextEditor {
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index 03fed82379..99a42a3178 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -12,7 +12,6 @@
#include <Applications/TextEditor/TextEditorWindowGML.h>
#include <LibConfig/Client.h>
#include <LibCore/Debounce.h>
-#include <LibCore/File.h>
#include <LibCpp/SyntaxHighlighter.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>
diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp
index ef8131d3d4..ff4e6453dd 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.cpp
+++ b/Userland/Applications/ThemeEditor/MainWidget.cpp
@@ -589,8 +589,8 @@ void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI::
bool open_folder = path_picker_target == PathPickerTarget::Folder;
auto window_title = DeprecatedString::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name);
auto target_path = path_input.text();
- if (Core::File::exists(target_path)) {
- if (!Core::File::is_directory(target_path))
+ if (Core::DeprecatedFile::exists(target_path)) {
+ if (!Core::DeprecatedFile::is_directory(target_path))
target_path = LexicalPath::dirname(target_path);
} else {
target_path = "/res/icons";
diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp
index 93498e581e..da97df0626 100644
--- a/Userland/Applications/ThemeEditor/main.cpp
+++ b/Userland/Applications/ThemeEditor/main.cpp
@@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Optional<DeprecatedString> path = {};
if (!file_to_edit.is_empty())
- path = Core::File::absolute_path(file_to_edit);
+ path = Core::DeprecatedFile::absolute_path(file_to_edit);
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath unix"));
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
diff --git a/Userland/Demos/CatDog/CatDog.h b/Userland/Demos/CatDog/CatDog.h
index ddabc8f39f..f5daca0e4d 100644
--- a/Userland/Demos/CatDog/CatDog.h
+++ b/Userland/Demos/CatDog/CatDog.h
@@ -12,7 +12,6 @@
#include <AK/RefPtr.h>
#include <AK/Types.h>
#include <LibCore/ElapsedTimer.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibGUI/Menu.h>
#include <LibGUI/MouseTracker.h>
diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp
index 1bf96a70e8..597b50860c 100644
--- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp
+++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp
@@ -12,8 +12,8 @@
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/FilePicker.h>
@@ -150,7 +150,7 @@ Optional<DeprecatedString> NewProjectDialog::get_available_project_name()
? chosen_name
: DeprecatedString::formatted("{}-{}", chosen_name, i);
- if (!Core::File::exists(DeprecatedString::formatted("{}/{}", create_in, candidate)))
+ if (!Core::DeprecatedFile::exists(DeprecatedString::formatted("{}/{}", create_in, candidate)))
return candidate;
}
@@ -188,7 +188,7 @@ void NewProjectDialog::do_create_project()
}
auto create_in = m_create_in_input->text();
- if (!Core::File::exists(create_in) || !Core::File::is_directory(create_in)) {
+ if (!Core::DeprecatedFile::exists(create_in) || !Core::DeprecatedFile::is_directory(create_in)) {
auto result = GUI::MessageBox::show(this, DeprecatedString::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (result != GUI::MessageBox::ExecResult::Yes)
return;
diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp
index c4c15a402d..4fe98a0b61 100644
--- a/Userland/DevTools/HackStudio/Editor.cpp
+++ b/Userland/DevTools/HackStudio/Editor.cpp
@@ -15,8 +15,8 @@
#include <AK/JsonParser.h>
#include <AK/LexicalPath.h>
#include <LibConfig/Client.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/Timer.h>
#include <LibCpp/SemanticSyntaxHighlighter.h>
@@ -420,7 +420,7 @@ static HashMap<DeprecatedString, DeprecatedString>& include_paths()
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
while (it.has_next()) {
auto path = it.next_full_path();
- if (!Core::File::is_directory(path)) {
+ if (!Core::DeprecatedFile::is_directory(path)) {
auto key = path.substring(base.length() + 1, path.length() - base.length() - 1);
dbgln_if(EDITOR_DEBUG, "Adding header \"{}\" in path \"{}\"", key, path);
paths.set(key, path);
diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
index 8c2a159051..e079a84dd5 100644
--- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp
+++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
@@ -7,7 +7,6 @@
#include "GitWidget.h"
#include "../Dialogs/Git/GitCommitDialog.h"
#include "GitFilesModel.h"
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibDiff/Format.h>
#include <LibGUI/Application.h>
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 7cfd771a4c..464baebc50 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -27,9 +27,9 @@
#include <AK/StringBuilder.h>
#include <Kernel/API/InodeWatcherEvent.h>
#include <LibConfig/Client.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/FileWatcher.h>
#include <LibCore/System.h>
#include <LibDebug/DebugSession.h>
@@ -312,7 +312,7 @@ bool HackStudioWidget::open_file(DeprecatedString const& full_filename, size_t l
if (full_filename.starts_with(project().root_path())) {
filename = LexicalPath::relative_path(full_filename, project().root_path());
}
- if (Core::File::is_directory(filename) || !Core::File::exists(filename))
+ if (Core::DeprecatedFile::is_directory(filename) || !Core::DeprecatedFile::exists(filename))
return false;
auto editor_wrapper_or_none = m_all_editor_wrappers.first_matching([&](auto& wrapper) {
@@ -534,13 +534,13 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(Dep
DeprecatedString filepath;
if (!path_to_selected.is_empty()) {
- VERIFY(Core::File::exists(path_to_selected.first()));
+ VERIFY(Core::DeprecatedFile::exists(path_to_selected.first()));
LexicalPath selected(path_to_selected.first());
DeprecatedString dir_path;
- if (Core::File::is_directory(selected.string()))
+ if (Core::DeprecatedFile::is_directory(selected.string()))
dir_path = selected.string();
else
dir_path = selected.dirname();
@@ -574,7 +574,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio
DeprecatedString dir_path;
- if (Core::File::is_directory(selected.string()))
+ if (Core::DeprecatedFile::is_directory(selected.string()))
dir_path = selected.string();
else
dir_path = selected.dirname();
@@ -682,7 +682,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
}
bool is_directory = S_ISDIR(st.st_mode);
- if (auto result = Core::File::remove(file, Core::File::RecursionMode::Allowed); result.is_error()) {
+ if (auto result = Core::DeprecatedFile::remove(file, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) {
auto& error = result.error();
if (is_directory) {
GUI::MessageBox::show(window(),
@@ -904,7 +904,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window(),
old_filename.is_null() ? "Untitled"sv : old_path.title(),
old_filename.is_null() ? "txt"sv : old_path.extension(),
- Core::File::absolute_path(old_path.dirname()));
+ Core::DeprecatedFile::absolute_path(old_path.dirname()));
if (!save_path.has_value()) {
return;
}
@@ -1001,7 +1001,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_debug_action()
{
auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"sv));
return GUI::Action::create("&Debug", icon, [this](auto&) {
- if (!Core::File::exists(get_project_executable_path())) {
+ if (!Core::DeprecatedFile::exists(get_project_executable_path())) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
@@ -1245,7 +1245,7 @@ void HackStudioWidget::configure_project_tree_view()
auto selections = m_project_tree_view->selection().indices();
auto it = selections.find_if([&](auto selected_file) {
- return Core::File::can_delete_or_move(m_project->model().full_path(selected_file));
+ return Core::DeprecatedFile::can_delete_or_move(m_project->model().full_path(selected_file));
});
bool has_permissions = it != selections.end();
m_tree_view_rename_action->set_enabled(has_permissions);
@@ -1779,10 +1779,10 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_project_config
DeprecatedString formatted_error_string_holder;
auto save_configuration_or_error = [&]() -> ErrorOr<void> {
- if (Core::File::exists(absolute_config_file_path))
+ if (Core::DeprecatedFile::exists(absolute_config_file_path))
return {};
- if (Core::File::exists(parent_directory) && !Core::File::is_directory(parent_directory)) {
+ if (Core::DeprecatedFile::exists(parent_directory) && !Core::DeprecatedFile::is_directory(parent_directory)) {
formatted_error_string_holder = DeprecatedString::formatted("Cannot create the '{}' directory because there is already a file with that name", parent_directory);
return Error::from_string_view(formatted_error_string_holder);
}
diff --git a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp
index 8efddd65fd..500b3be695 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp
+++ b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp
@@ -8,7 +8,6 @@
#include "ConnectionFromClient.h"
#include <AK/Debug.h>
#include <AK/HashMap.h>
-#include <LibCore/File.h>
#include <LibGUI/TextDocument.h>
namespace LanguageServers {
diff --git a/Userland/DevTools/HackStudio/Project.cpp b/Userland/DevTools/HackStudio/Project.cpp
index f78472771d..f15a33fc6c 100644
--- a/Userland/DevTools/HackStudio/Project.cpp
+++ b/Userland/DevTools/HackStudio/Project.cpp
@@ -6,7 +6,7 @@
#include "Project.h"
#include "HackStudio.h"
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
namespace HackStudio {
@@ -18,7 +18,7 @@ Project::Project(DeprecatedString const& root_path)
OwnPtr<Project> Project::open_with_root_path(DeprecatedString const& root_path)
{
- if (!Core::File::is_directory(root_path))
+ if (!Core::DeprecatedFile::is_directory(root_path))
return {};
return adopt_own(*new Project(root_path));
}
diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp
index 71089a49a4..8fc1c05812 100644
--- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp
+++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp
@@ -7,7 +7,7 @@
#include "ProjectBuilder.h"
#include <AK/LexicalPath.h>
#include <LibCore/Command.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibRegex/Regex.h>
#include <fcntl.h>
@@ -125,15 +125,15 @@ ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_p
ErrorOr<void> ProjectBuilder::initialize_build_directory()
{
- if (!Core::File::exists(build_directory())) {
+ if (!Core::DeprecatedFile::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::File::exists(cmake_file_path))
- MUST(Core::File::remove(cmake_file_path, Core::File::RecursionMode::Disallowed));
+ if (Core::DeprecatedFile::exists(cmake_file_path))
+ MUST(Core::DeprecatedFile::remove(cmake_file_path, Core::DeprecatedFile::RecursionMode::Disallowed));
auto cmake_file = TRY(Core::Stream::File::open(cmake_file_path, Core::Stream::OpenMode::Write));
TRY(cmake_file->write_entire_buffer(generate_cmake_file_content().bytes()));
@@ -151,7 +151,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::File::exists(cmake_path.string()))
+ if (Core::DeprecatedFile::exists(cmake_path.string()))
return cmake_path.string();
directory = LexicalPath::dirname(directory);
}
diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.cpp b/Userland/DevTools/HackStudio/ProjectTemplate.cpp
index 66c7f39a83..3f4983ab2e 100644
--- a/Userland/DevTools/HackStudio/ProjectTemplate.cpp
+++ b/Userland/DevTools/HackStudio/ProjectTemplate.cpp
@@ -9,8 +9,8 @@
#include <AK/LexicalPath.h>
#include <AK/StringBuilder.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <fcntl.h>
#include <spawn.h>
#include <sys/stat.h>
@@ -52,7 +52,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(DeprecatedString con
auto bitmap_path_32 = DeprecatedString::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x"));
- if (Core::File::exists(bitmap_path_32)) {
+ if (Core::DeprecatedFile::exists(bitmap_path_32)) {
auto bitmap_or_error = Gfx::Bitmap::load_from_file(bitmap_path_32);
if (!bitmap_or_error.is_error())
icon = GUI::Icon(bitmap_or_error.release_value());
@@ -64,15 +64,15 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(DeprecatedString con
Result<void, DeprecatedString> ProjectTemplate::create_project(DeprecatedString const& name, DeprecatedString const& path)
{
// Check if a file or directory already exists at the project path
- if (Core::File::exists(path))
+ if (Core::DeprecatedFile::exists(path))
return DeprecatedString("File or directory already exists at specified location.");
dbgln("Creating project at path '{}' with name '{}'", path, name);
// Verify that the template content directory exists. If it does, copy it's contents.
// Otherwise, create an empty directory at the project path.
- if (Core::File::is_directory(content_path())) {
- auto result = Core::File::copy_file_or_directory(path, content_path());
+ if (Core::DeprecatedFile::is_directory(content_path())) {
+ auto result = Core::DeprecatedFile::copy_file_or_directory(path, content_path());
dbgln("Copying {} -> {}", content_path(), path);
if (result.is_error())
return DeprecatedString::formatted("Failed to copy template contents. Error code: {}", static_cast<Error const&>(result.error()));
diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp
index 089f43540a..7025f00bd0 100644
--- a/Userland/DevTools/HackStudio/main.cpp
+++ b/Userland/DevTools/HackStudio/main.cpp
@@ -11,7 +11,7 @@
#include <AK/StringBuilder.h>
#include <LibConfig/Client.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Menubar.h>
@@ -60,9 +60,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(mode_coredump, "Debug a coredump in HackStudio", "coredump", 'c');
args_parser.parse(arguments);
- auto argument_absolute_path = Core::File::real_path_for(path_argument);
+ auto argument_absolute_path = Core::DeprecatedFile::real_path_for(path_argument);
- auto project_path = Core::File::real_path_for(".");
+ auto project_path = Core::DeprecatedFile::real_path_for(".");
if (!mode_coredump) {
if (!argument_absolute_path.is_null())
project_path = argument_absolute_path;
@@ -143,7 +143,7 @@ static Optional<DeprecatedString> last_opened_project_path()
if (projects.size() == 0)
return {};
- if (!Core::File::exists(projects[0]))
+ if (!Core::DeprecatedFile::exists(projects[0]))
return {};
return { projects[0] };
diff --git a/Userland/DevTools/Profiler/Process.cpp b/Userland/DevTools/Profiler/Process.cpp
index a2c592e783..2fdcb376ea 100644
--- a/Userland/DevTools/Profiler/Process.cpp
+++ b/Userland/DevTools/Profiler/Process.cpp
@@ -5,7 +5,7 @@
*/
#include "Process.h"
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
namespace Profiler {
@@ -93,7 +93,7 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co
DeprecatedString full_path;
if (path_string.starts_with('/'))
full_path = path_string;
- else if (Core::File::looks_like_shared_library(path_string))
+ else if (Core::DeprecatedFile::looks_like_shared_library(path_string))
full_path = DeprecatedString::formatted("/usr/lib/{}", path);
else
full_path = path_string;
diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp
index 43ef8d83a2..09700fb205 100644
--- a/Userland/DevTools/SQLStudio/MainWidget.cpp
+++ b/Userland/DevTools/SQLStudio/MainWidget.cpp
@@ -6,8 +6,8 @@
*/
#include <DevTools/SQLStudio/SQLStudioGML.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>
@@ -45,7 +45,7 @@ static Vector<DeprecatedString> lookup_database_names()
static constexpr auto database_extension = ".db"sv;
auto database_path = DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory());
- if (!Core::File::exists(database_path))
+ if (!Core::DeprecatedFile::exists(database_path))
return {};
Core::DirIterator iterator(move(database_path), Core::DirIterator::SkipParentAndBaseDir);
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
index 2034d456b2..c4157b1ca4 100644
--- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
@@ -13,7 +13,6 @@
#include <AK/LexicalPath.h>
#include <AK/StringUtils.h>
#include <Kernel/API/MemoryLayout.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibELF/AuxiliaryVector.h>
#include <LibELF/Image.h>
@@ -424,7 +423,7 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address)
return {};
DeprecatedString lib_path = lib_name;
- if (Core::File::looks_like_shared_library(lib_name))
+ if (Core::DeprecatedFile::looks_like_shared_library(lib_name))
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_path);
if (!m_dynamic_library_cache.contains(lib_path)) {
@@ -462,7 +461,7 @@ Optional<Emulator::SymbolInfo> Emulator::symbol_at(FlatPtr address)
auto const* first_region = (lib_name.is_null() || lib_name.is_empty()) ? address_region : first_region_for_object(lib_name);
VERIFY(first_region);
auto lib_path = lib_name;
- if (Core::File::looks_like_shared_library(lib_name)) {
+ if (Core::DeprecatedFile::looks_like_shared_library(lib_name)) {
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_name);
}
diff --git a/Userland/DevTools/UserspaceEmulator/main.cpp b/Userland/DevTools/UserspaceEmulator/main.cpp
index 336cc192e0..eda37b6d7e 100644
--- a/Userland/DevTools/UserspaceEmulator/main.cpp
+++ b/Userland/DevTools/UserspaceEmulator/main.cpp
@@ -10,7 +10,6 @@
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Process.h>
#include <fcntl.h>
#include <pthread.h>
@@ -46,9 +45,9 @@ int main(int argc, char** argv, char** env)
DeprecatedString executable_path;
if (arguments[0].contains("/"sv))
- executable_path = Core::File::real_path_for(arguments[0]);
+ executable_path = Core::DeprecatedFile::real_path_for(arguments[0]);
else
- executable_path = Core::File::resolve_executable_from_environment(arguments[0]).value_or({});
+ executable_path = Core::DeprecatedFile::resolve_executable_from_environment(arguments[0]).value_or({});
if (executable_path.is_empty()) {
reportln("Cannot find executable for '{}'."sv, arguments[0]);
return 1;
diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp
index e28c9b08ee..a28b5fc13c 100644
--- a/Userland/Games/Chess/Engine.cpp
+++ b/Userland/Games/Chess/Engine.cpp
@@ -5,7 +5,7 @@
*/
#include "Engine.h"
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <fcntl.h>
#include <spawn.h>
#include <stdio.h>
@@ -48,12 +48,12 @@ Engine::Engine(StringView command)
close(wpipefds[0]);
close(rpipefds[1]);
- auto infile = Core::File::construct();
- infile->open(rpipefds[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes);
+ auto infile = Core::DeprecatedFile::construct();
+ infile->open(rpipefds[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
set_in(infile);
- auto outfile = Core::File::construct();
- outfile->open(wpipefds[1], Core::OpenMode::WriteOnly, Core::File::ShouldCloseFileDescriptor::Yes);
+ auto outfile = Core::DeprecatedFile::construct();
+ outfile->open(wpipefds[1], Core::OpenMode::WriteOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
set_out(outfile);
send_command(Chess::UCI::UCICommand());
diff --git a/Userland/Libraries/LibAudio/WavLoader.h b/Userland/Libraries/LibAudio/WavLoader.h
index 28be15af86..d43b1e9129 100644
--- a/Userland/Libraries/LibAudio/WavLoader.h
+++ b/Userland/Libraries/LibAudio/WavLoader.h
@@ -14,7 +14,6 @@
#include <AK/Span.h>
#include <AK/StringView.h>
#include <LibAudio/Loader.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
namespace Audio {
diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp
index 521a0a15f8..bbba9b15e8 100644
--- a/Userland/Libraries/LibAudio/WavWriter.cpp
+++ b/Userland/Libraries/LibAudio/WavWriter.cpp
@@ -5,6 +5,7 @@
*/
#include <LibAudio/WavWriter.h>
+#include <LibCore/DeprecatedFile.h>
namespace Audio {
@@ -31,7 +32,7 @@ WavWriter::~WavWriter()
void WavWriter::set_file(StringView path)
{
- m_file = Core::File::construct(path);
+ m_file = Core::DeprecatedFile::construct(path);
if (!m_file->open(Core::OpenMode::ReadWrite)) {
m_error_string = DeprecatedString::formatted("Can't open file: {}", m_file->error_string());
return;
diff --git a/Userland/Libraries/LibAudio/WavWriter.h b/Userland/Libraries/LibAudio/WavWriter.h
index 7d6b31eeb5..dbfbd5457e 100644
--- a/Userland/Libraries/LibAudio/WavWriter.h
+++ b/Userland/Libraries/LibAudio/WavWriter.h
@@ -6,10 +6,13 @@
#pragma once
+#include <AK/DeprecatedString.h>
#include <AK/Noncopyable.h>
+#include <AK/RefPtr.h>
#include <AK/StringView.h>
#include <LibAudio/Sample.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
+#include <LibCore/Forward.h>
namespace Audio {
@@ -31,7 +34,7 @@ public:
u32 sample_rate() const { return m_sample_rate; }
u16 num_channels() const { return m_num_channels; }
u16 bits_per_sample() const { return m_bits_per_sample; }
- RefPtr<Core::File> file() const { return m_file; }
+ RefPtr<Core::DeprecatedFile> file() const { return m_file; }
void set_file(StringView path);
void set_num_channels(int num_channels) { m_num_channels = num_channels; }
@@ -42,7 +45,7 @@ public:
private:
void write_header();
- RefPtr<Core::File> m_file;
+ RefPtr<Core::DeprecatedFile> m_file;
DeprecatedString m_error_string;
bool m_finalized { false };
diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp
index 108b3a2be1..8eb0757148 100644
--- a/Userland/Libraries/LibC/unistd.cpp
+++ b/Userland/Libraries/LibC/unistd.cpp
@@ -9,7 +9,7 @@
#include <AK/ScopedValueRollback.h>
#include <AK/Vector.h>
#include <Kernel/API/Unveil.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <alloca.h>
#include <assert.h>
#include <bits/pthread_cancel.h>
@@ -188,7 +188,7 @@ int execvpe(char const* filename, char* const argv[], char* const envp[])
ScopedValueRollback errno_rollback(errno);
- // TODO: Make this use the PATH search implementation from Core::File.
+ // TODO: Make this use the PATH search implementation from Core::DeprecatedFile.
DeprecatedString path = getenv("PATH");
if (path.is_empty())
path = DEFAULT_PATH;
diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp
index 286adaa409..fad07d619e 100644
--- a/Userland/Libraries/LibChess/UCIEndpoint.cpp
+++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp
@@ -9,7 +9,6 @@
#include <AK/Debug.h>
#include <AK/DeprecatedString.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
namespace Chess::UCI {
diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp
index 53d6bed7e9..5b6780da19 100644
--- a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp
+++ b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp
@@ -9,8 +9,8 @@
#include <AK/HashTable.h>
#include <AK/OwnPtr.h>
#include <AK/ScopeGuard.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCpp/AST.h>
#include <LibCpp/Lexer.h>
#include <LibCpp/Parser.h>
@@ -736,7 +736,7 @@ Optional<Vector<CodeComprehension::AutocompleteResultEntry>> CppComprehensionEng
if (!path.starts_with(partial_basename))
continue;
- if (Core::File::is_directory(LexicalPath::join(full_dir, path).string())) {
+ if (Core::DeprecatedFile::is_directory(LexicalPath::join(full_dir, path).string())) {
// FIXME: Don't dismiss the autocomplete when filling these suggestions.
auto completion = DeprecatedString::formatted("{}{}{}/", prefix, include_dir, path);
options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path, CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No);
diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp
index 3cd1e8dc38..fbe9d92b17 100644
--- a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp
+++ b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp
@@ -8,7 +8,7 @@
#include "../FileDB.h"
#include "CppComprehensionEngine.h"
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibMain/Main.h>
static bool s_some_test_failed = false;
@@ -77,7 +77,7 @@ int run_tests()
static void add_file(FileDB& filedb, DeprecatedString const& name)
{
- auto file = Core::File::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly);
+ auto file = Core::DeprecatedFile::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly);
VERIFY(!file.is_error());
filedb.add(name, DeprecatedString::copy(file.value()->read_all()));
}
diff --git a/Userland/Libraries/LibConfig/Client.h b/Userland/Libraries/LibConfig/Client.h
index 4394fe276c..3c711fc97f 100644
--- a/Userland/Libraries/LibConfig/Client.h
+++ b/Userland/Libraries/LibConfig/Client.h
@@ -8,7 +8,6 @@
#include <ConfigServer/ConfigClientEndpoint.h>
#include <ConfigServer/ConfigServerEndpoint.h>
-#include <LibCore/File.h>
#include <LibCore/Promise.h>
#include <LibCore/StandardPaths.h>
#include <LibIPC/ConnectionToServer.h>
diff --git a/Userland/Libraries/LibCore/CMakeLists.txt b/Userland/Libraries/LibCore/CMakeLists.txt
index 473812dae4..7d32e1b1a1 100644
--- a/Userland/Libraries/LibCore/CMakeLists.txt
+++ b/Userland/Libraries/LibCore/CMakeLists.txt
@@ -4,12 +4,12 @@ set(SOURCES
Command.cpp
ConfigFile.cpp
DateTime.cpp
+ DeprecatedFile.cpp
Directory.cpp
DirIterator.cpp
ElapsedTimer.cpp
Event.cpp
EventLoop.cpp
- File.cpp
IODevice.cpp
LockFile.cpp
MappedFile.cpp
diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp
index e3a318c680..ee89735247 100644
--- a/Userland/Libraries/LibCore/Command.cpp
+++ b/Userland/Libraries/LibCore/Command.cpp
@@ -7,7 +7,7 @@
#include "Command.h"
#include <AK/Format.h>
#include <AK/ScopeGuard.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/wait.h>
@@ -73,8 +73,8 @@ ErrorOr<CommandResult> command(DeprecatedString const& program, Vector<Deprecate
close(stderr_pipe[1]);
auto read_all_from_pipe = [](int pipe[2]) {
- auto result_file = Core::File::construct();
- if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) {
+ auto result_file = Core::DeprecatedFile::construct();
+ if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes)) {
perror("open");
VERIFY_NOT_REACHED();
}
diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/DeprecatedFile.cpp
index 77a649fc33..7bf17fa971 100644
--- a/Userland/Libraries/LibCore/File.cpp
+++ b/Userland/Libraries/LibCore/DeprecatedFile.cpp
@@ -7,8 +7,8 @@
#include <AK/LexicalPath.h>
#include <AK/Platform.h>
#include <AK/ScopeGuard.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <errno.h>
#include <fcntl.h>
@@ -30,27 +30,27 @@
namespace Core {
-ErrorOr<NonnullRefPtr<File>> File::open(DeprecatedString filename, OpenMode mode, mode_t permissions)
+ErrorOr<NonnullRefPtr<DeprecatedFile>> DeprecatedFile::open(DeprecatedString filename, OpenMode mode, mode_t permissions)
{
- auto file = File::construct(move(filename));
+ auto file = DeprecatedFile::construct(move(filename));
if (!file->open_impl(mode, permissions))
return Error::from_errno(file->error());
return file;
}
-File::File(DeprecatedString filename, Object* parent)
+DeprecatedFile::DeprecatedFile(DeprecatedString filename, Object* parent)
: IODevice(parent)
, m_filename(move(filename))
{
}
-File::~File()
+DeprecatedFile::~DeprecatedFile()
{
if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes && mode() != OpenMode::NotOpen)
close();
}
-bool File::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
+bool DeprecatedFile::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
{
set_fd(fd);
set_mode(mode);
@@ -58,12 +58,12 @@ bool File::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
return true;
}
-bool File::open(OpenMode mode)
+bool DeprecatedFile::open(OpenMode mode)
{
return open_impl(mode, 0666);
}
-bool File::open_impl(OpenMode mode, mode_t permissions)
+bool DeprecatedFile::open_impl(OpenMode mode, mode_t permissions)
{
VERIFY(!m_filename.is_null());
int flags = 0;
@@ -96,18 +96,18 @@ bool File::open_impl(OpenMode mode, mode_t permissions)
return true;
}
-int File::leak_fd()
+int DeprecatedFile::leak_fd()
{
m_should_close_file_descriptor = ShouldCloseFileDescriptor::No;
return fd();
}
-bool File::is_device() const
+bool DeprecatedFile::is_device() const
{
return is_device(fd());
}
-bool File::is_device(DeprecatedString const& filename)
+bool DeprecatedFile::is_device(DeprecatedString const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
@@ -115,7 +115,7 @@ bool File::is_device(DeprecatedString const& filename)
return S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode);
}
-bool File::is_device(int fd)
+bool DeprecatedFile::is_device(int fd)
{
struct stat st;
if (fstat(fd, &st) < 0)
@@ -123,7 +123,7 @@ bool File::is_device(int fd)
return S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode);
}
-bool File::is_block_device() const
+bool DeprecatedFile::is_block_device() const
{
struct stat stat;
if (fstat(fd(), &stat) < 0)
@@ -131,7 +131,7 @@ bool File::is_block_device() const
return S_ISBLK(stat.st_mode);
}
-bool File::is_block_device(DeprecatedString const& filename)
+bool DeprecatedFile::is_block_device(DeprecatedString const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
@@ -139,7 +139,7 @@ bool File::is_block_device(DeprecatedString const& filename)
return S_ISBLK(st.st_mode);
}
-bool File::is_char_device() const
+bool DeprecatedFile::is_char_device() const
{
struct stat stat;
if (fstat(fd(), &stat) < 0)
@@ -147,7 +147,7 @@ bool File::is_char_device() const
return S_ISCHR(stat.st_mode);
}
-bool File::is_char_device(DeprecatedString const& filename)
+bool DeprecatedFile::is_char_device(DeprecatedString const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
@@ -155,12 +155,12 @@ bool File::is_char_device(DeprecatedString const& filename)
return S_ISCHR(st.st_mode);
}
-bool File::is_directory() const
+bool DeprecatedFile::is_directory() const
{
return is_directory(fd());
}
-bool File::is_directory(DeprecatedString const& filename)
+bool DeprecatedFile::is_directory(DeprecatedString const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
@@ -168,7 +168,7 @@ bool File::is_directory(DeprecatedString const& filename)
return S_ISDIR(st.st_mode);
}
-bool File::is_directory(int fd)
+bool DeprecatedFile::is_directory(int fd)
{
struct stat st;
if (fstat(fd, &st) < 0)
@@ -176,7 +176,7 @@ bool File::is_directory(int fd)
return S_ISDIR(st.st_mode);
}
-bool File::is_link() const
+bool DeprecatedFile::is_link() const
{
struct stat stat;
if (fstat(fd(), &stat) < 0)
@@ -184,7 +184,7 @@ bool File::is_link() const
return S_ISLNK(stat.st_mode);
}
-bool File::is_link(DeprecatedString const& filename)
+bool DeprecatedFile::is_link(DeprecatedString const& filename)
{
struct stat st;
if (lstat(filename.characters(), &st) < 0)
@@ -192,17 +192,17 @@ bool File::is_link(DeprecatedString const& filename)
return S_ISLNK(st.st_mode);
}
-bool File::looks_like_shared_library() const
+bool DeprecatedFile::looks_like_shared_library() const
{
- return File::looks_like_shared_library(m_filename);
+ return DeprecatedFile::looks_like_shared_library(m_filename);
}
-bool File::looks_like_shared_library(DeprecatedString const& filename)
+bool DeprecatedFile::looks_like_shared_library(DeprecatedString const& filename)
{
return filename.ends_with(".so"sv) || filename.contains(".so."sv);
}
-bool File::can_delete_or_move(StringView path)
+bool DeprecatedFile::can_delete_or_move(StringView path)
{
VERIFY(!path.is_empty());
auto directory = LexicalPath::dirname(path);
@@ -229,12 +229,12 @@ bool File::can_delete_or_move(StringView path)
return user_id == 0 || directory_stat.st_uid == user_id || stat_or_empty(path).st_uid == user_id;
}
-bool File::exists(StringView filename)
+bool DeprecatedFile::exists(StringView filename)
{
return !Core::System::stat(filename).is_error();
}
-ErrorOr<size_t> File::size(DeprecatedString const& filename)
+ErrorOr<size_t> DeprecatedFile::size(DeprecatedString const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
@@ -242,7 +242,7 @@ ErrorOr<size_t> File::size(DeprecatedString const& filename)
return st.st_size;
}
-DeprecatedString File::real_path_for(DeprecatedString const& filename)
+DeprecatedString DeprecatedFile::real_path_for(DeprecatedString const& filename)
{
if (filename.is_null())
return {};
@@ -252,7 +252,7 @@ DeprecatedString File::real_path_for(DeprecatedString const& filename)
return real_path;
}
-DeprecatedString File::current_working_directory()
+DeprecatedString DeprecatedFile::current_working_directory()
{
char* cwd = getcwd(nullptr, 0);
if (!cwd) {
@@ -266,15 +266,15 @@ DeprecatedString File::current_working_directory()
return cwd_as_string;
}
-DeprecatedString File::absolute_path(DeprecatedString const& path)
+DeprecatedString DeprecatedFile::absolute_path(DeprecatedString const& path)
{
- if (File::exists(path))
- return File::real_path_for(path);
+ if (DeprecatedFile::exists(path))
+ return DeprecatedFile::real_path_for(path);
if (path.starts_with("/"sv))
return LexicalPath::canonicalized_path(path);
- auto working_directory = File::current_working_directory();
+ auto working_directory = DeprecatedFile::current_working_directory();
auto full_path = LexicalPath::join(working_directory, path);
return LexicalPath::canonicalized_path(full_path.string());
@@ -282,7 +282,7 @@ DeprecatedString File::absolute_path(DeprecatedString const& path)
#ifdef AK_OS_SERENITY
-ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
+ErrorOr<DeprecatedString> DeprecatedFile::read_link(DeprecatedString const& link_path)
{
// First, try using a 64-byte buffer, that ought to be enough for anybody.
char small_buffer[64];
@@ -323,7 +323,7 @@ ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
// This is a sad version for other systems. It has to always make a copy of the
// link path, and to always make two syscalls to get the right size first.
-ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
+ErrorOr<DeprecatedString> DeprecatedFile::read_link(DeprecatedString const& link_path)
{
struct stat statbuf = {};
int rc = lstat(link_path.characters(), &statbuf);
@@ -341,32 +341,32 @@ ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
#endif
-static RefPtr<File> stdin_file;
-static RefPtr<File> stdout_file;
-static RefPtr<File> stderr_file;
+static RefPtr<DeprecatedFile> stdin_file;
+static RefPtr<DeprecatedFile> stdout_file;
+static RefPtr<DeprecatedFile> stderr_file;
-NonnullRefPtr<File> File::standard_input()
+NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_input()
{
if (!stdin_file) {
- stdin_file = File::construct();
+ stdin_file = DeprecatedFile::construct();
stdin_file->open(STDIN_FILENO, OpenMode::ReadOnly, ShouldCloseFileDescriptor::No);
}
return *stdin_file;
}
-NonnullRefPtr<File> File::standard_output()
+NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_output()
{
if (!stdout_file) {
- stdout_file = File::construct();
+ stdout_file = DeprecatedFile::construct();
stdout_file->open(STDOUT_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No);
}
return *stdout_file;
}
-NonnullRefPtr<File> File::standard_error()
+NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_error()
{
if (!stderr_file) {
- stderr_file = File::construct();
+ stderr_file = DeprecatedFile::construct();
stderr_file->open(STDERR_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No);
}
return *stderr_file;
@@ -397,7 +397,7 @@ static DeprecatedString get_duplicate_name(DeprecatedString const& path, int dup
return duplicated_name.to_deprecated_string();
}
-ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode)
+ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode)
{
if (add_duplicate_file_marker == AddDuplicateFileMarker::Yes) {
int duplicate_count = 0;
@@ -409,7 +409,7 @@ ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString con
}
}
- auto source_or_error = File::open(src_path, OpenMode::ReadOnly);
+ auto source_or_error = DeprecatedFile::open(src_path, OpenMode::ReadOnly);
if (source_or_error.is_error())
return CopyError { errno, false };
@@ -435,7 +435,7 @@ ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString con
return copy_file(dst_path, src_stat, source, preserve_mode);
}
-ErrorOr<void, File::CopyError> File::copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode preserve_mode)
+ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, DeprecatedFile& source, PreserveMode preserve_mode)
{
int dst_fd = creat(dst_path.characters(), 0666);
if (dst_fd < 0) {
@@ -507,14 +507,14 @@ ErrorOr<void, File::CopyError> File::copy_file(DeprecatedString const& dst_path,
return {};
}
-ErrorOr<void, File::CopyError> File::copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode)
+ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode)
{
if (mkdir(dst_path.characters(), 0755) < 0)
return CopyError { errno, false };
- DeprecatedString src_rp = File::real_path_for(src_path);
+ DeprecatedString src_rp = DeprecatedFile::real_path_for(src_path);
src_rp = DeprecatedString::formatted("{}/", src_rp);
- DeprecatedString dst_rp = File::real_path_for(dst_path);
+ DeprecatedString dst_rp = DeprecatedFile::real_path_for(dst_path);
dst_rp = DeprecatedString::formatted("{}/", dst_rp);
if (!dst_rp.is_empty() && dst_rp.starts_with(src_rp))
@@ -562,7 +562,7 @@ ErrorOr<void, File::CopyError> File::copy_directory(DeprecatedString const& dst_
return {};
}
-ErrorOr<void> File::link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path)
+ErrorOr<void> DeprecatedFile::link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path)
{
int duplicate_count = 0;
while (access(get_duplicate_name(dst_path, duplicate_count).characters(), F_OK) == 0) {
@@ -576,7 +576,7 @@ ErrorOr<void> File::link_file(DeprecatedString const& dst_path, DeprecatedString
return {};
}
-ErrorOr<void> File::remove(StringView path, RecursionMode mode)
+ErrorOr<void> DeprecatedFile::remove(StringView path, RecursionMode mode)
{
auto path_stat = TRY(Core::System::lstat(path));
@@ -597,7 +597,7 @@ ErrorOr<void> File::remove(StringView path, RecursionMode mode)
return {};
}
-Optional<DeprecatedString> File::resolve_executable_from_environment(StringView filename)
+Optional<DeprecatedString> DeprecatedFile::resolve_executable_from_environment(StringView filename)
{
if (filename.is_empty())
return {};
diff --git a/Userland/Libraries/LibCore/File.h b/Userland/Libraries/LibCore/DeprecatedFile.h
index 4dbeaa1414..7f9c1b7082 100644
--- a/Userland/Libraries/LibCore/File.h
+++ b/Userland/Libraries/LibCore/DeprecatedFile.h
@@ -21,12 +21,12 @@ namespace Core {
/// Use of Core::File for reading/writing data is deprecated.
/// Please use Core::Stream::File and Core::Stream::BufferedFile instead.
///
-class File final : public IODevice {
- C_OBJECT(File)
+class DeprecatedFile final : public IODevice {
+ C_OBJECT(DeprecatedFile)
public:
- virtual ~File() override;
+ virtual ~DeprecatedFile() override;
- static ErrorOr<NonnullRefPtr<File>> open(DeprecatedString filename, OpenMode, mode_t = 0644);
+ static ErrorOr<NonnullRefPtr<DeprecatedFile>> open(DeprecatedString filename, OpenMode, mode_t = 0644);
DeprecatedString filename() const { return m_filename; }
void set_filename(const DeprecatedString filename) { m_filename = move(filename); }
@@ -86,7 +86,7 @@ public:
bool tried_recursing;
};
- static ErrorOr<void, CopyError> copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode = PreserveMode::Nothing);
+ static ErrorOr<void, CopyError> copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, DeprecatedFile& source, PreserveMode = PreserveMode::Nothing);
static ErrorOr<void, CopyError> copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed, PreserveMode = PreserveMode::Nothing);
static ErrorOr<void, CopyError> copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes, PreserveMode = PreserveMode::Nothing);
@@ -105,18 +105,18 @@ public:
bool open(int fd, OpenMode, ShouldCloseFileDescriptor);
[[nodiscard]] int leak_fd();
- static NonnullRefPtr<File> standard_input();
- static NonnullRefPtr<File> standard_output();
- static NonnullRefPtr<File> standard_error();
+ static NonnullRefPtr<DeprecatedFile> standard_input();
+ static NonnullRefPtr<DeprecatedFile> standard_output();
+ static NonnullRefPtr<DeprecatedFile> standard_error();
static Optional<DeprecatedString> resolve_executable_from_environment(StringView filename);
private:
- File(Object* parent = nullptr)
+ DeprecatedFile(Object* parent = nullptr)
: IODevice(parent)
{
}
- explicit File(DeprecatedString filename, Object* parent = nullptr);
+ explicit DeprecatedFile(DeprecatedString filename, Object* parent = nullptr);
bool open_impl(OpenMode, mode_t);
@@ -124,6 +124,6 @@ private:
ShouldCloseFileDescriptor m_should_close_file_descriptor { ShouldCloseFileDescriptor::Yes };
};
-AK_ENUM_BITWISE_OPERATORS(File::PreserveMode);
+AK_ENUM_BITWISE_OPERATORS(DeprecatedFile::PreserveMode);
}
diff --git a/Userland/Libraries/LibCore/Forward.h b/Userland/Libraries/LibCore/Forward.h
index 15e45cc405..db97705312 100644
--- a/Userland/Libraries/LibCore/Forward.h
+++ b/Userland/Libraries/LibCore/Forward.h
@@ -14,12 +14,12 @@ class ChildEvent;
class ConfigFile;
class CustomEvent;
class DateTime;
+class DeprecatedFile;
class DirIterator;
class DeferredInvocationContext;
class ElapsedTimer;
class Event;
class EventLoop;
-class File;
class IODevice;
class LocalServer;
class MimeData;
diff --git a/Userland/Libraries/LibCore/Group.cpp b/Userland/Libraries/LibCore/Group.cpp
index 0f07a0b5ee..bf99278b1b 100644
--- a/Userland/Libraries/LibCore/Group.cpp
+++ b/Userland/Libraries/LibCore/Group.cpp
@@ -7,7 +7,6 @@
#include <AK/CharacterTypes.h>
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
-#include <LibCore/File.h>
#include <LibCore/Group.h>
#include <LibCore/System.h>
#include <LibCore/UmaskScope.h>
diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp
index 796b50f072..821d15436a 100644
--- a/Userland/Libraries/LibCore/Stream.cpp
+++ b/Userland/Libraries/LibCore/Stream.cpp
@@ -36,7 +36,7 @@ ErrorOr<NonnullOwnPtr<File>> File::adopt_fd(int fd, OpenMode mode, ShouldCloseFi
}
if (!has_any_flag(mode, OpenMode::ReadWrite)) {
- dbgln("Core::File::adopt_fd: Attempting to adopt a file with neither Read nor Write specified in mode");
+ dbgln("Core::DeprecatedFile::adopt_fd: Attempting to adopt a file with neither Read nor Write specified in mode");
return Error::from_errno(EINVAL);
}
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp
index 941c21987e..0c36c83938 100644
--- a/Userland/Libraries/LibCore/System.cpp
+++ b/Userland/Libraries/LibCore/System.cpp
@@ -12,7 +12,7 @@
#include <AK/ScopedValueRollback.h>
#include <AK/StdLibExtras.h>
#include <AK/Vector.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/SessionManagement.h>
#include <LibCore/System.h>
#include <limits.h>
@@ -1156,7 +1156,7 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear
DeprecatedString exec_filename;
if (search_in_path == SearchInPath::Yes) {
- auto maybe_executable = Core::File::resolve_executable_from_environment(filename);
+ auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename);
if (!maybe_executable.has_value())
return ENOENT;
@@ -1195,7 +1195,7 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear
// These BSDs don't support execvpe(), so we'll have to manually search the PATH.
ScopedValueRollback errno_rollback(errno);
- auto maybe_executable = Core::File::resolve_executable_from_environment(filename_string);
+ auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename_string);
if (!maybe_executable.has_value()) {
errno_rollback.set_override_rollback_value(ENOENT);
diff --git a/Userland/Libraries/LibCore/TempFile.cpp b/Userland/Libraries/LibCore/TempFile.cpp
index e13f5ccec6..527ad911e4 100644
--- a/Userland/Libraries/LibCore/TempFile.cpp
+++ b/Userland/Libraries/LibCore/TempFile.cpp
@@ -6,7 +6,7 @@
#include "TempFile.h"
#include <AK/Random.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
@@ -45,11 +45,11 @@ TempFile::TempFile(Type type)
TempFile::~TempFile()
{
- File::RecursionMode recursion_allowed { File::RecursionMode::Disallowed };
+ DeprecatedFile::RecursionMode recursion_allowed { DeprecatedFile::RecursionMode::Disallowed };
if (m_type == Type::Directory)
- recursion_allowed = File::RecursionMode::Allowed;
+ recursion_allowed = DeprecatedFile::RecursionMode::Allowed;
- auto rc = File::remove(m_path, recursion_allowed);
+ auto rc = DeprecatedFile::remove(m_path, recursion_allowed);
if (rc.is_error()) {
warnln("File::remove failed: {}", rc.error().string_literal());
}
diff --git a/Userland/Libraries/LibCoredump/Backtrace.cpp b/Userland/Libraries/LibCoredump/Backtrace.cpp
index 54fdfbd221..94ae94859b 100644
--- a/Userland/Libraries/LibCoredump/Backtrace.cpp
+++ b/Userland/Libraries/LibCoredump/Backtrace.cpp
@@ -9,7 +9,7 @@
#include <AK/Platform.h>
#include <AK/StringBuilder.h>
#include <AK/Types.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibCoredump/Backtrace.h>
#include <LibCoredump/Reader.h>
@@ -26,7 +26,7 @@ ELFObjectInfo const* Backtrace::object_info_for_region(Reader const& coredump, M
if (maybe_ptr.has_value())
return *maybe_ptr;
- if (!Core::File::exists(path))
+ if (!Core::DeprecatedFile::exists(path))
return nullptr;
auto file_or_error = Core::MappedFile::map(path);
diff --git a/Userland/Libraries/LibCoredump/Reader.cpp b/Userland/Libraries/LibCoredump/Reader.cpp
index 5f84958909..dbbdc2285d 100644
--- a/Userland/Libraries/LibCoredump/Reader.cpp
+++ b/Userland/Libraries/LibCoredump/Reader.cpp
@@ -11,7 +11,7 @@
#include <AK/JsonValue.h>
#include <AK/LexicalPath.h>
#include <LibCompress/Gzip.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCoredump/Reader.h>
#include <signal.h>
#include <string.h>
@@ -297,7 +297,7 @@ DeprecatedString Reader::resolve_object_path(StringView name) const
// (e.g. UserspaceEmulator, LibSymbolication, Profiler, and DynamicLinker itself)
// We should consider creating unified implementation in the future.
- if (name.starts_with('/') || !Core::File::looks_like_shared_library(name)) {
+ if (name.starts_with('/') || !Core::DeprecatedFile::looks_like_shared_library(name)) {
return name;
}
diff --git a/Userland/Libraries/LibCpp/Tests/parser/strace.ast b/Userland/Libraries/LibCpp/Tests/parser/strace.ast
index 7eb2d0d36d..91c7265c86 100644
--- a/Userland/Libraries/LibCpp/Tests/parser/strace.ast
+++ b/Userland/Libraries/LibCpp/Tests/parser/strace.ast
@@ -108,13 +108,13 @@ TranslationUnit[0:0->144:0]
[const] char
output_filename
NullPointerLiteral[21:34->21:40]
- VariableDeclaration[22:4->22:50]
+ VariableDeclaration[22:4->22:60]
NamedType[22:4->22:7]
auto
trace_file
- FunctionCall[22:22->22:50]
- Name[22:22->22:47]
- Core::File::standard_error
+ FunctionCall[22:22->22:60]
+ Name[22:22->22:57]
+ Core::DeprecatedFile::standard_error
VariableDeclaration[24:4->24:27]
NamedType[24:4->24:19]
Core::ArgsParser
@@ -192,16 +192,16 @@ TranslationUnit[0:0->144:0]
NullPointerLiteral[33:27->33:33]
Then:
BlockStatement[33:36->42:4]
- VariableDeclaration[34:8->34:87]
+ VariableDeclaration[34:8->34:97]
NamedType[34:8->34:11]
auto
open_result
- FunctionCall[34:27->34:87]
- Name[34:27->34:42]
- Core::File::open
- Name[34:44->34:58]
+ FunctionCall[34:27->34:97]
+ Name[34:27->34:52]
+ Core::DeprecatedFile::open
+ Name[34:54->34:68]
output_filename
- Name[34:61->34:85]
+ Name[34:71->34:95]
Core::OpenMode::WriteOnly
IfStatement[35:8->39:8]
Predicate:
diff --git a/Userland/Libraries/LibCpp/Tests/parser/strace.cpp b/Userland/Libraries/LibCpp/Tests/parser/strace.cpp
index 9844198f63..b7f1c2d6d1 100644
--- a/Userland/Libraries/LibCpp/Tests/parser/strace.cpp
+++ b/Userland/Libraries/LibCpp/Tests/parser/strace.cpp
@@ -20,7 +20,7 @@ int main(int argc, char** argv)
Vector<const char*> child_argv;
const char* output_filename = nullptr;
- auto trace_file = Core::File::standard_error();
+ auto trace_file = Core::DeprecatedFile::standard_error();
Core::ArgsParser parser;
parser.set_general_help(
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
parser.parse(argc, argv);
if (output_filename != nullptr) {
- auto open_result = Core::File::open(output_filename, Core::OpenMode::WriteOnly);
+ auto open_result = Core::DeprecatedFile::open(output_filename, Core::OpenMode::WriteOnly);
if (open_result.is_error()) {
outln(stderr, "Failed to open output file: {}", open_result.error());
return 1;
diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp
index 6566da1b78..b135814118 100644
--- a/Userland/Libraries/LibDebug/DebugSession.cpp
+++ b/Userland/Libraries/LibDebug/DebugSession.cpp
@@ -10,7 +10,7 @@
#include <AK/LexicalPath.h>
#include <AK/Optional.h>
#include <AK/Platform.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibRegex/Regex.h>
#include <stdlib.h>
#include <sys/mman.h>
@@ -444,7 +444,7 @@ Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::ins
void DebugSession::update_loaded_libs()
{
- auto file = Core::File::construct(DeprecatedString::formatted("/proc/{}/vm", m_debuggee_pid));
+ auto file = Core::DeprecatedFile::construct(DeprecatedString::formatted("/proc/{}/vm", m_debuggee_pid));
bool rc = file->open(Core::OpenMode::ReadOnly);
VERIFY(rc);
@@ -476,7 +476,7 @@ void DebugSession::update_loaded_libs()
return IterationDecision::Continue;
DeprecatedString lib_name = object_path.value();
- if (Core::File::looks_like_shared_library(lib_name))
+ if (Core::DeprecatedFile::looks_like_shared_library(lib_name))
lib_name = LexicalPath::basename(object_path.value());
FlatPtr base_address = entry.as_object().get_addr("address"sv).value_or(0);
diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
index 8ddfd71c50..ea57978b0b 100644
--- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
+++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp
@@ -6,7 +6,6 @@
*/
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/MessageBox.h>
@@ -41,7 +40,7 @@ DeprecatedResult Client::try_request_file_read_only_approved_deprecated(GUI::Win
if (path.starts_with('/')) {
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, path);
} else {
- auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
+ auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, full_path);
}
@@ -66,7 +65,7 @@ Result Client::request_file_read_only_approved(GUI::Window* parent_window, Depre
if (path.starts_with('/')) {
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, path);
} else {
- auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
+ auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, full_path);
}
@@ -114,7 +113,7 @@ DeprecatedResult Client::try_request_file_deprecated(GUI::Window* parent_window,
if (path.starts_with('/')) {
async_request_file(id, parent_window_server_client_id, parent_window_id, path, mode);
} else {
- auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
+ auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
async_request_file(id, parent_window_server_client_id, parent_window_id, full_path, mode);
}
@@ -139,7 +138,7 @@ Result Client::request_file(GUI::Window* parent_window, DeprecatedString const&
if (path.starts_with('/')) {
async_request_file(id, parent_window_server_client_id, parent_window_id, path, mode);
} else {
- auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
+ auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
async_request_file(id, parent_window_server_client_id, parent_window_id, full_path, mode);
}
@@ -253,22 +252,22 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
return;
}
- if (Core::File::is_device(ipc_file->fd())) {
+ if (Core::DeprecatedFile::is_device(ipc_file->fd())) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open device files", *chosen_file));
resolve_any_promise(Error::from_string_literal("Cannot open device files"));
return;
}
- if (Core::File::is_directory(ipc_file->fd())) {
+ if (Core::DeprecatedFile::is_directory(ipc_file->fd())) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open directory", *chosen_file));
resolve_any_promise(Error::from_errno(EISDIR));
return;
}
if (request_data.promise.has<PromiseType<DeprecatedResult>>()) {
- auto file = Core::File::construct();
+ auto file = Core::DeprecatedFile::construct();
auto fd = ipc_file->take_fd();
- file->open(fd, Core::OpenMode::ReadWrite, Core::File::ShouldCloseFileDescriptor::Yes);
+ file->open(fd, Core::OpenMode::ReadWrite, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
file->set_filename(*chosen_file);
request_data.promise.get<PromiseType<DeprecatedResult>>()->resolve(file);
diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.h b/Userland/Libraries/LibFileSystemAccessClient/Client.h
index 32236bc0f0..a1ca4209ae 100644
--- a/Userland/Libraries/LibFileSystemAccessClient/Client.h
+++ b/Userland/Libraries/LibFileSystemAccessClient/Client.h
@@ -11,7 +11,7 @@
#include <AK/String.h>
#include <FileSystemAccessServer/FileSystemAccessClientEndpoint.h>
#include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Promise.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/Window.h>
@@ -37,7 +37,7 @@ private:
String m_filename;
};
-using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::File>>;
+using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::DeprecatedFile>>;
using Result = ErrorOr<File>;
class Client final
diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
index 658c9e15ea..df70abeb01 100644
--- a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
+++ b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp
@@ -11,7 +11,6 @@
#include <AK/LexicalPath.h>
#include <AK/StringView.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
#include <LibGUI/AbstractThemePreview.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Bitmap.h>
diff --git a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp
index 75b187615c..9beebbf005 100644
--- a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp
+++ b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp
@@ -8,7 +8,7 @@
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/Vector.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
#include <LibGUI/CommonLocationsProvider.h>
@@ -25,7 +25,7 @@ static void initialize_if_needed()
return;
auto user_config = DeprecatedString::formatted("{}/CommonLocations.json", Core::StandardPaths::config_directory());
- if (Core::File::exists(user_config)) {
+ if (Core::DeprecatedFile::exists(user_config)) {
auto maybe_error = CommonLocationsProvider::load_from_json(user_config);
if (!maybe_error.is_error())
return;
diff --git a/Userland/Libraries/LibGUI/FileIconProvider.cpp b/Userland/Libraries/LibGUI/FileIconProvider.cpp
index 31797d7388..74a331b103 100644
--- a/Userland/Libraries/LibGUI/FileIconProvider.cpp
+++ b/Userland/Libraries/LibGUI/FileIconProvider.cpp
@@ -9,7 +9,7 @@
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibELF/Image.h>
@@ -255,7 +255,7 @@ Icon FileIconProvider::icon_for_path(DeprecatedString const& path, mode_t mode)
return s_directory_icon;
}
if (S_ISLNK(mode)) {
- auto raw_symlink_target_or_error = Core::File::read_link(path);
+ auto raw_symlink_target_or_error = Core::DeprecatedFile::read_link(path);
if (raw_symlink_target_or_error.is_error())
return s_symlink_icon;
@@ -267,7 +267,7 @@ Icon FileIconProvider::icon_for_path(DeprecatedString const& path, mode_t mode)
if (raw_symlink_target.starts_with('/')) {
target_path = raw_symlink_target;
} else {
- target_path = Core::File::real_path_for(DeprecatedString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
+ target_path = Core::DeprecatedFile::real_path_for(DeprecatedString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
}
auto target_icon = icon_for_path(target_path);
diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp
index 97fb785394..b5db27f7da 100644
--- a/Userland/Libraries/LibGUI/FilePicker.cpp
+++ b/Userland/Libraries/LibGUI/FilePicker.cpp
@@ -6,7 +6,7 @@
#include <AK/Function.h>
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/Action.h>
#include <LibGUI/BoxLayout.h>
@@ -310,7 +310,7 @@ void FilePicker::on_file_return()
path = LexicalPath::join(m_model->root_path(), path).string();
}
- bool file_exists = Core::File::exists(path);
+ bool file_exists = Core::DeprecatedFile::exists(path);
if (!file_exists && (m_mode == Mode::Open || m_mode == Mode::OpenFolder)) {
MessageBox::show(this, DeprecatedString::formatted("No such file or directory: {}", m_filename_textbox->text()), "File not found"sv, MessageBox::Type::Error, MessageBox::InputType::OK);
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index 545b4fda7c..287e12a581 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -10,8 +10,8 @@
#include <AK/NumberFormat.h>
#include <AK/QuickSort.h>
#include <AK/StringBuilder.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/AbstractView.h>
#include <LibGUI/FileIconProvider.h>
@@ -61,7 +61,7 @@ bool FileSystemModel::Node::fetch_data(DeprecatedString const& full_path, bool i
mtime = st.st_mtime;
if (S_ISLNK(mode)) {
- auto sym_link_target_or_error = Core::File::read_link(full_path);
+ auto sym_link_target_or_error = Core::DeprecatedFile::read_link(full_path);
if (sym_link_target_or_error.is_error())
perror("readlink");
else {
diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
index cedb394b99..f92cb9e84a 100644
--- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp
+++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
@@ -5,14 +5,14 @@
*/
#include <AK/JsonObject.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibGUI/JsonArrayModel.h>
namespace GUI {
void JsonArrayModel::invalidate()
{
- auto file = Core::File::construct(m_json_path);
+ auto file = Core::DeprecatedFile::construct(m_json_path);
if (!file->open(Core::OpenMode::ReadOnly)) {
dbgln("Unable to open {}", file->filename());
m_array.clear();
@@ -30,7 +30,7 @@ void JsonArrayModel::invalidate()
void JsonArrayModel::update()
{
- auto file = Core::File::construct(m_json_path);
+ auto file = Core::DeprecatedFile::construct(m_json_path);
if (!file->open(Core::OpenMode::ReadOnly)) {
dbgln("Unable to open {}", file->filename());
m_array.clear();
@@ -48,7 +48,7 @@ void JsonArrayModel::update()
bool JsonArrayModel::store()
{
- auto file = Core::File::construct(m_json_path);
+ auto file = Core::DeprecatedFile::construct(m_json_path);
if (!file->open(Core::OpenMode::WriteOnly)) {
dbgln("Unable to open {}", file->filename());
return false;
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 2f23fdad78..622a8902ee 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -11,7 +11,7 @@
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <AK/TemporaryChange.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Timer.h>
#include <LibGUI/Action.h>
#include <LibGUI/AutocompleteProvider.h>
diff --git a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp
index 746d02f830..4088f97596 100644
--- a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp
+++ b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp
@@ -8,8 +8,8 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/Queue.h>
#include <AK/QuickSort.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/OpenType/Font.h>
@@ -136,7 +136,7 @@ void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
while (dir_iterator.has_next()) {
auto path = dir_iterator.next_full_path();
- if (Core::File::is_directory(path)) {
+ if (Core::DeprecatedFile::is_directory(path)) {
path_queue.enqueue(path);
continue;
}
diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp
index 3fac6549e7..2fe98cdd21 100644
--- a/Userland/Libraries/LibIDL/IDLParser.cpp
+++ b/Userland/Libraries/LibIDL/IDLParser.cpp
@@ -11,7 +11,7 @@
#include <AK/Assertions.h>
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
[[noreturn]] static void report_parsing_error(StringView message, StringView filename, StringView input, size_t offset)
@@ -138,10 +138,10 @@ static HashTable<DeprecatedString> import_stack;
Optional<Interface&> Parser::resolve_import(auto path)
{
auto include_path = LexicalPath::join(import_base_path, path).string();
- if (!Core::File::exists(include_path))
+ if (!Core::DeprecatedFile::exists(include_path))
report_parsing_error(DeprecatedString::formatted("{}: No such file or directory", include_path), filename, input, lexer.tell());
- auto real_path = Core::File::real_path_for(include_path);
+ auto real_path = Core::DeprecatedFile::real_path_for(include_path);
if (top_level_resolved_imports().contains(real_path))
return *top_level_resolved_imports().find(real_path)->value;
@@ -884,7 +884,7 @@ void resolve_function_typedefs(Interface& interface, FunctionType& function)
Interface& Parser::parse()
{
- auto this_module = Core::File::real_path_for(filename);
+ auto this_module = Core::DeprecatedFile::real_path_for(filename);
auto interface_ptr = make<Interface>();
auto& interface = *interface_ptr;
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index d1001a86e9..f4b7e62458 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -12,7 +12,7 @@
#include <AK/ScopeGuard.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibJS/AST.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/AbstractOperations.h>
@@ -833,18 +833,18 @@ static DeprecatedString resolve_module_filename(StringView filename, StringView
auto extensions = Vector<StringView, 2> { "js"sv, "mjs"sv };
if (module_type == "json"sv)
extensions = { "json"sv };
- if (!Core::File::exists(filename)) {
+ if (!Core::DeprecatedFile::exists(filename)) {
for (auto extension : extensions) {
// import "./foo" -> import "./foo.ext"
auto resolved_filepath = DeprecatedString::formatted("{}.{}", filename, extension);
- if (Core::File::exists(resolved_filepath))
+ if (Core::DeprecatedFile::exists(resolved_filepath))
return resolved_filepath;
}
- } else if (Core::File::is_directory(filename)) {
+ } else if (Core::DeprecatedFile::is_directory(filename)) {
for (auto extension : extensions) {
// import "./foo" -> import "./foo/index.ext"
auto resolved_filepath = LexicalPath::join(filename, DeprecatedString::formatted("index.{}", extension)).string();
- if (Core::File::exists(resolved_filepath))
+ if (Core::DeprecatedFile::exists(resolved_filepath))
return resolved_filepath;
}
}
@@ -916,7 +916,7 @@ ThrowCompletionOr<NonnullGCPtr<Module>> VM::resolve_imported_module(ScriptOrModu
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] reading and parsing module {}", filename);
- auto file_or_error = Core::File::open(filename, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(filename, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
return throw_completion<SyntaxError>(ErrorType::ModuleNotFound, module_request.module_specifier);
diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
index 7b3cae7821..38e5904549 100644
--- a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
+++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
@@ -7,7 +7,7 @@
#include "CharacterMapFile.h"
#include <AK/ByteBuffer.h>
#include <AK/Utf8View.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
namespace Keyboard {
@@ -22,7 +22,7 @@ ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(DeprecatedString cons
path = full_path.to_deprecated_string();
}
- auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
+ auto file = TRY(Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly));
auto file_contents = file->read_all();
auto json_result = TRY(JsonValue::from_string(file_contents));
auto const& json = json_result.as_object();
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index fc6dc6d358..ad165c79c3 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -18,9 +18,9 @@
#include <AK/Utf32View.h>
#include <AK/Utf8View.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/Notifier.h>
#include <errno.h>
#include <fcntl.h>
@@ -251,7 +251,7 @@ void Editor::add_to_history(DeprecatedString const& line)
bool Editor::load_history(DeprecatedString const& path)
{
- auto history_file = Core::File::construct(path);
+ auto history_file = Core::DeprecatedFile::construct(path);
if (!history_file->open(Core::OpenMode::ReadOnly))
return false;
auto data = history_file->read_all();
@@ -311,7 +311,7 @@ bool Editor::save_history(DeprecatedString const& path)
{
Vector<HistoryEntry> final_history { { "", 0 } };
{
- auto file_or_error = Core::File::open(path, Core::OpenMode::ReadWrite, 0600);
+ auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadWrite, 0600);
if (file_or_error.is_error())
return false;
auto file = file_or_error.release_value();
@@ -326,7 +326,7 @@ bool Editor::save_history(DeprecatedString const& path)
[](HistoryEntry const& left, HistoryEntry const& right) { return left.timestamp < right.timestamp; });
}
- auto file_or_error = Core::File::open(path, Core::OpenMode::WriteOnly, 0600);
+ auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::WriteOnly, 0600);
if (file_or_error.is_error())
return false;
auto file = file_or_error.release_value();
diff --git a/Userland/Libraries/LibManual/Node.cpp b/Userland/Libraries/LibManual/Node.cpp
index 57b596aeb2..044b4143b7 100644
--- a/Userland/Libraries/LibManual/Node.cpp
+++ b/Userland/Libraries/LibManual/Node.cpp
@@ -12,7 +12,7 @@
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <AK/URL.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibManual/Path.h>
@@ -49,7 +49,7 @@ ErrorOr<NonnullRefPtr<PageNode>> Node::try_create_from_query(Vector<StringView,
Optional<NonnullRefPtr<PageNode>> maybe_page;
for (auto const& section : sections) {
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(first_query_parameter))));
- if (Core::File::exists(TRY(page->path()))) {
+ if (Core::DeprecatedFile::exists(TRY(page->path()))) {
maybe_page = page;
break;
}
@@ -62,7 +62,7 @@ ErrorOr<NonnullRefPtr<PageNode>> Node::try_create_from_query(Vector<StringView,
auto second_query_parameter = *query_parameter_iterator;
auto section = TRY(SectionNode::try_create_from_number(first_query_parameter));
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(second_query_parameter))));
- if (Core::File::exists(TRY(page->path())))
+ if (Core::DeprecatedFile::exists(TRY(page->path())))
return page;
return Error::from_string_literal("Page doesn't exist in section");
}
diff --git a/Userland/Libraries/LibManual/SectionNode.cpp b/Userland/Libraries/LibManual/SectionNode.cpp
index 1dc0e447ff..a4077a134d 100644
--- a/Userland/Libraries/LibManual/SectionNode.cpp
+++ b/Userland/Libraries/LibManual/SectionNode.cpp
@@ -10,8 +10,8 @@
#include "SubsectionNode.h"
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
namespace Manual {
@@ -54,7 +54,7 @@ ErrorOr<void> SectionNode::reify_if_needed() const
while (dir_iter.has_next()) {
LexicalPath lexical_path(dir_iter.next_path());
if (lexical_path.extension() != "md") {
- if (Core::File::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
+ if (Core::DeprecatedFile::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
dbgln("Found subsection {}", lexical_path);
children.append({ .node = TRY(try_make_ref_counted<SubsectionNode>(*this, lexical_path.title())),
.name_for_sorting = TRY(String::from_utf8(lexical_path.title())) });
diff --git a/Userland/Libraries/LibPartition/EBRPartitionTable.cpp b/Userland/Libraries/LibPartition/EBRPartitionTable.cpp
index 74d873b51b..a2c039f796 100644
--- a/Userland/Libraries/LibPartition/EBRPartitionTable.cpp
+++ b/Userland/Libraries/LibPartition/EBRPartitionTable.cpp
@@ -6,6 +6,10 @@
#include <LibPartition/EBRPartitionTable.h>
+#ifndef KERNEL
+# include <LibCore/DeprecatedFile.h>
+#endif
+
namespace Partition {
#ifdef KERNEL
@@ -13,7 +17,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(K
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(device)));
#else
-ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
+ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(move(device_file))));
#endif
@@ -27,7 +31,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(N
#ifdef KERNEL
void EBRPartitionTable::search_extended_partition(Kernel::StorageDevice const& device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
#else
-void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::File> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
+void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::DeprecatedFile> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
#endif
{
if (limit == 0)
@@ -51,7 +55,7 @@ void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::File> devi
#ifdef KERNEL
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice const& device)
#else
-EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::File> device)
+EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device)
#endif
: MBRPartitionTable(device)
{
diff --git a/Userland/Libraries/LibPartition/EBRPartitionTable.h b/Userland/Libraries/LibPartition/EBRPartitionTable.h
index 0e381293a3..36598b054a 100644
--- a/Userland/Libraries/LibPartition/EBRPartitionTable.h
+++ b/Userland/Libraries/LibPartition/EBRPartitionTable.h
@@ -19,8 +19,8 @@ public:
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
explicit EBRPartitionTable(Kernel::StorageDevice const&);
#else
- static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
- explicit EBRPartitionTable(NonnullRefPtr<Core::File>);
+ static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
+ explicit EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
#endif
virtual bool is_valid() const override
@@ -32,7 +32,7 @@ private:
#ifdef KERNEL
void search_extended_partition(Kernel::StorageDevice const&, MBRPartitionTable&, u64, size_t limit);
#else
- void search_extended_partition(NonnullRefPtr<Core::File>, MBRPartitionTable&, u64, size_t limit);
+ void search_extended_partition(NonnullRefPtr<Core::DeprecatedFile>, MBRPartitionTable&, u64, size_t limit);
#endif
bool m_valid { false };
diff --git a/Userland/Libraries/LibPartition/GUIDPartitionTable.cpp b/Userland/Libraries/LibPartition/GUIDPartitionTable.cpp
index fb2c261b32..284771b7a2 100644
--- a/Userland/Libraries/LibPartition/GUIDPartitionTable.cpp
+++ b/Userland/Libraries/LibPartition/GUIDPartitionTable.cpp
@@ -7,6 +7,10 @@
#include <AK/Debug.h>
#include <LibPartition/GUIDPartitionTable.h>
+#ifndef KERNEL
+# include <LibCore/DeprecatedFile.h>
+#endif
+
namespace Partition {
#define GPT_SIGNATURE2 0x54524150
@@ -49,7 +53,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)));
#else
-ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
+ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(move(device_file))));
#endif
@@ -62,7 +66,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice const& device)
: MBRPartitionTable(device)
#else
-GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::File> device_file)
+GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
: MBRPartitionTable(move(device_file))
#endif
{
diff --git a/Userland/Libraries/LibPartition/GUIDPartitionTable.h b/Userland/Libraries/LibPartition/GUIDPartitionTable.h
index c36110e480..f8e21dcd01 100644
--- a/Userland/Libraries/LibPartition/GUIDPartitionTable.h
+++ b/Userland/Libraries/LibPartition/GUIDPartitionTable.h
@@ -19,8 +19,8 @@ public:
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
explicit GUIDPartitionTable(Kernel::StorageDevice const&);
#else
- static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
- explicit GUIDPartitionTable(NonnullRefPtr<Core::File>);
+ static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
+ explicit GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
#endif
virtual bool is_valid() const override
diff --git a/Userland/Libraries/LibPartition/MBRPartitionTable.cpp b/Userland/Libraries/LibPartition/MBRPartitionTable.cpp
index 9ba3a27147..2064df17a3 100644
--- a/Userland/Libraries/LibPartition/MBRPartitionTable.cpp
+++ b/Userland/Libraries/LibPartition/MBRPartitionTable.cpp
@@ -7,6 +7,10 @@
#include <AK/Debug.h>
#include <LibPartition/MBRPartitionTable.h>
+#ifndef KERNEL
+# include <LibCore/DeprecatedFile.h>
+#endif
+
namespace Partition {
#define MBR_SIGNATURE 0xaa55
@@ -19,7 +23,7 @@ ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(K
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device)));
#else
-ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
+ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
{
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(move(device_file))));
#endif
@@ -37,7 +41,7 @@ OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(Kernel::StorageDe
{
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device, start_lba)).release_value_but_fixme_should_propagate_errors();
#else
-OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file, u32 start_lba)
+OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
{
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(move(device_file), start_lba)).release_value_but_fixme_should_propagate_errors();
#endif
@@ -65,7 +69,7 @@ bool MBRPartitionTable::read_boot_record()
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device, u32 start_lba)
: PartitionTable(device)
#else
-MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file, u32 start_lba)
+MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
: PartitionTable(move(device_file))
#endif
, m_start_lba(start_lba)
@@ -91,7 +95,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file, u32
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device)
: PartitionTable(device)
#else
-MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file)
+MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
: PartitionTable(move(device_file))
#endif
, m_start_lba(0)
diff --git a/Userland/Libraries/LibPartition/MBRPartitionTable.h b/Userland/Libraries/LibPartition/MBRPartitionTable.h
index 62c126fc79..48bc24a6dd 100644
--- a/Userland/Libraries/LibPartition/MBRPartitionTable.h
+++ b/Userland/Libraries/LibPartition/MBRPartitionTable.h
@@ -44,10 +44,10 @@ public:
explicit MBRPartitionTable(Kernel::StorageDevice const&);
MBRPartitionTable(Kernel::StorageDevice const&, u32 start_lba);
#else
- static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
- static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::File>, u32 start_lba);
- explicit MBRPartitionTable(NonnullRefPtr<Core::File>);
- MBRPartitionTable(NonnullRefPtr<Core::File>, u32 start_lba);
+ static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
+ static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
+ explicit MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
+ MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
#endif
bool is_protective_mbr() const;
diff --git a/Userland/Libraries/LibPartition/PartitionTable.cpp b/Userland/Libraries/LibPartition/PartitionTable.cpp
index b3e16ea2dc..19940da367 100644
--- a/Userland/Libraries/LibPartition/PartitionTable.cpp
+++ b/Userland/Libraries/LibPartition/PartitionTable.cpp
@@ -7,6 +7,7 @@
#include <LibPartition/PartitionTable.h>
#ifndef KERNEL
+# include <LibCore/DeprecatedFile.h>
# include <sys/ioctl.h>
#endif
@@ -19,7 +20,7 @@ PartitionTable::PartitionTable(Kernel::StorageDevice const& device)
{
}
#else
-PartitionTable::PartitionTable(NonnullRefPtr<Core::File> device_file)
+PartitionTable::PartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
: m_device_file(device_file)
{
VERIFY(ioctl(m_device_file->leak_fd(), STORAGE_DEVICE_GET_BLOCK_SIZE, &m_block_size) >= 0);
diff --git a/Userland/Libraries/LibPartition/PartitionTable.h b/Userland/Libraries/LibPartition/PartitionTable.h
index fcbccf9bf8..d1026c5f71 100644
--- a/Userland/Libraries/LibPartition/PartitionTable.h
+++ b/Userland/Libraries/LibPartition/PartitionTable.h
@@ -6,12 +6,13 @@
#pragma once
+#include <AK/NonnullRefPtr.h>
#include <LibPartition/DiskPartitionMetadata.h>
#ifdef KERNEL
# include <Kernel/Storage/StorageDevice.h>
#else
-# include <LibCore/File.h>
+# include <LibCore/Forward.h>
#endif
namespace Partition {
@@ -31,8 +32,8 @@ protected:
explicit PartitionTable(Kernel::StorageDevice const&);
NonnullRefPtr<Kernel::StorageDevice> m_device;
#else
- explicit PartitionTable(NonnullRefPtr<Core::File>);
- NonnullRefPtr<Core::File> m_device_file;
+ explicit PartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
+ NonnullRefPtr<Core::DeprecatedFile> m_device_file;
#endif
Vector<DiskPartitionMetadata> m_partitions;
diff --git a/Userland/Libraries/LibSQL/BTree.h b/Userland/Libraries/LibSQL/BTree.h
index 1bc149e9c5..c47be1f2a7 100644
--- a/Userland/Libraries/LibSQL/BTree.h
+++ b/Userland/Libraries/LibSQL/BTree.h
@@ -13,7 +13,6 @@
#include <AK/Optional.h>
#include <AK/RefPtr.h>
#include <AK/Vector.h>
-#include <LibCore/File.h>
#include <LibCore/Object.h>
#include <LibSQL/Forward.h>
#include <LibSQL/Heap.h>
diff --git a/Userland/Libraries/LibSQL/SQLClient.cpp b/Userland/Libraries/LibSQL/SQLClient.cpp
index 00618df647..2cad3e8c8d 100644
--- a/Userland/Libraries/LibSQL/SQLClient.cpp
+++ b/Userland/Libraries/LibSQL/SQLClient.cpp
@@ -10,8 +10,8 @@
#include <LibSQL/SQLClient.h>
#if !defined(AK_OS_SERENITY)
+# include <LibCore/DeprecatedFile.h>
# include <LibCore/Directory.h>
-# include <LibCore/File.h>
# include <LibCore/SocketAddress.h>
# include <LibCore/StandardPaths.h>
# include <LibCore/Stream.h>
@@ -25,7 +25,7 @@ namespace SQL {
// This is heavily based on how SystemServer's Service creates its socket.
static ErrorOr<int> create_database_socket(DeprecatedString const& socket_path)
{
- if (Core::File::exists(socket_path))
+ if (Core::DeprecatedFile::exists(socket_path))
TRY(Core::System::unlink(socket_path));
# ifdef SOCK_NONBLOCK
@@ -103,7 +103,7 @@ static ErrorOr<void> launch_server(DeprecatedString const& socket_path, Deprecat
static ErrorOr<bool> should_launch_server(DeprecatedString const& pid_path)
{
- if (!Core::File::exists(pid_path))
+ if (!Core::DeprecatedFile::exists(pid_path))
return true;
Optional<pid_t> pid;
diff --git a/Userland/Libraries/LibSymbolication/Symbolication.cpp b/Userland/Libraries/LibSymbolication/Symbolication.cpp
index 9f5995f122..911be1fc41 100644
--- a/Userland/Libraries/LibSymbolication/Symbolication.cpp
+++ b/Userland/Libraries/LibSymbolication/Symbolication.cpp
@@ -10,7 +10,7 @@
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/LexicalPath.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibDebug/DebugInfo.h>
#include <LibSymbolication/Symbolication.h>
@@ -37,7 +37,7 @@ static KernelBaseState s_kernel_base_state = KernelBaseState::Uninitialized;
Optional<FlatPtr> kernel_base()
{
if (s_kernel_base_state == KernelBaseState::Uninitialized) {
- auto file = Core::File::open("/sys/kernel/load_base", Core::OpenMode::ReadOnly);
+ auto file = Core::DeprecatedFile::open("/sys/kernel/load_base", Core::OpenMode::ReadOnly);
if (file.is_error()) {
s_kernel_base_state = KernelBaseState::Invalid;
return {};
@@ -65,7 +65,7 @@ Optional<Symbol> symbolicate(DeprecatedString const& path, FlatPtr address, Incl
bool found = false;
for (auto& search_path : search_paths) {
full_path = LexicalPath::join(search_path, path).string();
- if (Core::File::exists(full_path)) {
+ if (Core::DeprecatedFile::exists(full_path)) {
found = true;
break;
}
@@ -147,7 +147,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in
{
auto stack_path = DeprecatedString::formatted("/proc/{}/stacks/{}", pid, tid);
- auto file_or_error = Core::File::open(stack_path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(stack_path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Could not open {}: {}", stack_path, file_or_error.error());
return {};
@@ -167,7 +167,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in
{
auto vm_path = DeprecatedString::formatted("/proc/{}/vm", pid);
- auto file_or_error = Core::File::open(vm_path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(vm_path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
warnln("Could not open {}: {}", vm_path, file_or_error.error());
return {};
diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp
index fefd7272be..4228f1a665 100644
--- a/Userland/Libraries/LibTLS/TLSv12.cpp
+++ b/Userland/Libraries/LibTLS/TLSv12.cpp
@@ -9,7 +9,6 @@
#include <AK/Endian.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DateTime.h>
-#include <LibCore/File.h>
#include <LibCore/Timer.h>
#include <LibCrypto/ASN1/ASN1.h>
#include <LibCrypto/ASN1/PEM.h>
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
index 9f39623e74..997802532a 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
@@ -17,7 +17,6 @@
#include <AK/Result.h>
#include <AK/Tuple.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibJS/Interpreter.h>
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
index 5618e78b30..579c3be5fd 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
@@ -7,6 +7,7 @@
*/
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibTest/JavaScriptTestRunner.h>
#include <signal.h>
#include <stdio.h>
@@ -152,7 +153,7 @@ int main(int argc, char** argv)
common_path = DeprecatedString::formatted("{}/Userland/Libraries/LibJS/Tests/test-common.js", serenity_source_dir);
#endif
}
- if (!Core::File::is_directory(test_root)) {
+ if (!Core::DeprecatedFile::is_directory(test_root)) {
warnln("Test root is not a directory: {}", test_root);
return 1;
}
@@ -170,8 +171,8 @@ int main(int argc, char** argv)
#endif
}
- test_root = Core::File::real_path_for(test_root);
- common_path = Core::File::real_path_for(common_path);
+ test_root = Core::DeprecatedFile::real_path_for(test_root);
+ common_path = Core::DeprecatedFile::real_path_for(common_path);
if (chdir(test_root.characters()) < 0) {
auto saved_errno = errno;
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 7b50a85ea9..ac104ff744 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -9,7 +9,6 @@
#include <AK/Debug.h>
#include <AK/JsonObject.h>
#include <LibCore/ElapsedTimer.h>
-#include <LibCore/File.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/Loader/ContentFilter.h>
diff --git a/Userland/Libraries/LibWebView/RequestServerAdapter.cpp b/Userland/Libraries/LibWebView/RequestServerAdapter.cpp
index 5dcac0eca8..b08f293233 100644
--- a/Userland/Libraries/LibWebView/RequestServerAdapter.cpp
+++ b/Userland/Libraries/LibWebView/RequestServerAdapter.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibCore/File.h>
#include <LibProtocol/Request.h>
#include <LibProtocol/RequestClient.h>
#include <LibWebView/RequestServerAdapter.h>
diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp
index 25cd8ab26e..ff5abf9a97 100644
--- a/Userland/Services/AudioServer/Mixer.cpp
+++ b/Userland/Services/AudioServer/Mixer.cpp
@@ -13,6 +13,7 @@
#include <AudioServer/ConnectionFromClient.h>
#include <AudioServer/Mixer.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Timer.h>
#include <pthread.h>
#include <sys/ioctl.h>
@@ -21,7 +22,7 @@ namespace AudioServer {
Mixer::Mixer(NonnullRefPtr<Core::ConfigFile> config)
// FIXME: Allow AudioServer to use other audio channels as well
- : m_device(Core::File::construct("/dev/audio/0", this))
+ : m_device(Core::DeprecatedFile::construct("/dev/audio/0", this))
, m_sound_thread(Threading::Thread::construct(
[this] {
mix();
diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h
index 67628019b6..fcb7367cd8 100644
--- a/Userland/Services/AudioServer/Mixer.h
+++ b/Userland/Services/AudioServer/Mixer.h
@@ -17,7 +17,6 @@
#include <AK/RefCounted.h>
#include <AK/WeakPtr.h>
#include <LibAudio/Queue.h>
-#include <LibCore/File.h>
#include <LibCore/Timer.h>
#include <LibThreading/ConditionVariable.h>
#include <LibThreading/Mutex.h>
@@ -129,7 +128,7 @@ private:
Threading::Mutex m_pending_mutex;
Threading::ConditionVariable m_mixing_necessary { m_pending_mutex };
- RefPtr<Core::File> m_device;
+ RefPtr<Core::DeprecatedFile> m_device;
NonnullRefPtr<Threading::Thread> m_sound_thread;
diff --git a/Userland/Services/ChessEngine/ChessEngine.cpp b/Userland/Services/ChessEngine/ChessEngine.cpp
index 4c92f4c221..15a8040a62 100644
--- a/Userland/Services/ChessEngine/ChessEngine.cpp
+++ b/Userland/Services/ChessEngine/ChessEngine.cpp
@@ -7,6 +7,7 @@
#include "ChessEngine.h"
#include "MCTSTree.h"
#include <AK/Random.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/ElapsedTimer.h>
using namespace Chess::UCI;
diff --git a/Userland/Services/ChessEngine/main.cpp b/Userland/Services/ChessEngine/main.cpp
index 7f7902e359..a16ca4e8a2 100644
--- a/Userland/Services/ChessEngine/main.cpp
+++ b/Userland/Services/ChessEngine/main.cpp
@@ -5,8 +5,8 @@
*/
#include "ChessEngine.h"
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -16,6 +16,6 @@ ErrorOr<int> serenity_main(Main::Arguments)
Core::EventLoop loop;
TRY(Core::System::unveil(nullptr, nullptr));
- auto engine = TRY(ChessEngine::try_create(Core::File::standard_input(), Core::File::standard_output()));
+ auto engine = TRY(ChessEngine::try_create(Core::DeprecatedFile::standard_input(), Core::DeprecatedFile::standard_output()));
return loop.exec();
}
diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp
index 9ea10573b2..1573a81280 100644
--- a/Userland/Services/DHCPClient/DHCPv4Client.cpp
+++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp
@@ -14,7 +14,7 @@
#include <AK/Random.h>
#include <AK/ScopeGuard.h>
#include <AK/Try.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Timer.h>
#include <stdio.h>
@@ -179,7 +179,7 @@ void DHCPv4Client::try_discover_ifs()
ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
{
- auto file = TRY(Core::File::open("/sys/kernel/net/adapters", Core::OpenMode::ReadOnly));
+ auto file = TRY(Core::DeprecatedFile::open("/sys/kernel/net/adapters", Core::OpenMode::ReadOnly));
auto file_contents = file->read_all();
auto json = JsonValue::from_string(file_contents);
diff --git a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp
index d368182a24..b4c5f97ef1 100644
--- a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp
+++ b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp
@@ -5,7 +5,7 @@
*/
#include <FileSystemAccessServer/ConnectionFromClient.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowServer.h>
@@ -67,7 +67,7 @@ void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_serve
auto pid = this->socket().peer_pid().release_value_but_fixme_should_propagate_errors();
auto exe_link = LexicalPath("/proc").append(DeprecatedString::number(pid)).append("exe"sv).string();
- auto exe_path = Core::File::real_path_for(exe_link);
+ auto exe_path = Core::DeprecatedFile::real_path_for(exe_link);
auto main_window = create_dummy_child_window(window_server_client_id, parent_window_id);
diff --git a/Userland/Services/KeyboardPreferenceLoader/main.cpp b/Userland/Services/KeyboardPreferenceLoader/main.cpp
index 1d6ab4112c..6fac3009fc 100644
--- a/Userland/Services/KeyboardPreferenceLoader/main.cpp
+++ b/Userland/Services/KeyboardPreferenceLoader/main.cpp
@@ -5,7 +5,7 @@
*/
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <errno.h>
@@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
}
bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true);
- auto keyboard_device = TRY(Core::File::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
+ auto keyboard_device = TRY(Core::DeprecatedFile::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
TRY(Core::System::ioctl(keyboard_device->fd(), KEYBOARD_IOCTL_SET_NUM_LOCK, enable_num_lock));
return 0;
diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp
index 1c0be751c0..b90d59409e 100644
--- a/Userland/Services/LaunchServer/Launcher.cpp
+++ b/Userland/Services/LaunchServer/Launcher.cpp
@@ -12,7 +12,7 @@
#include <AK/LexicalPath.h>
#include <AK/StringBuilder.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/Process.h>
#include <LibDesktop/AppFile.h>
@@ -179,7 +179,7 @@ Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url)
Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path)
{
- auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
+ auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly);
if (file_or_error.is_error()) {
return {};
} else {
@@ -308,7 +308,7 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
return;
if (S_ISLNK(st.st_mode)) {
- auto link_target_or_error = Core::File::read_link(path);
+ auto link_target_or_error = Core::DeprecatedFile::read_link(path);
if (link_target_or_error.is_error()) {
perror("read_link");
return;
@@ -316,7 +316,7 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
auto link_target = LexicalPath { link_target_or_error.release_value() };
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
- auto real_path = Core::File::real_path_for(absolute_link_target.string());
+ auto real_path = Core::DeprecatedFile::real_path_for(absolute_link_target.string());
return for_each_handler_for_path(real_path, [&](auto const& handler) -> bool {
return f(handler);
});
diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp
index b0fdbfe7d2..653de85efb 100644
--- a/Userland/Services/LookupServer/LookupServer.cpp
+++ b/Userland/Services/LookupServer/LookupServer.cpp
@@ -12,7 +12,7 @@
#include <AK/Random.h>
#include <AK/StringBuilder.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/LocalServer.h>
#include <LibCore/Stream.h>
#include <LibDNS/Packet.h>
@@ -83,7 +83,7 @@ void LookupServer::load_etc_hosts()
m_etc_hosts.ensure(name).empend(name, record_type, RecordClass::IN, s_static_ttl, move(data), false);
};
- auto file = Core::File::construct("/etc/hosts");
+ auto file = Core::DeprecatedFile::construct("/etc/hosts");
if (!file->open(Core::OpenMode::ReadOnly)) {
dbgln("Failed to open '/etc/hosts'");
return;
diff --git a/Userland/Services/LookupServer/MulticastDNS.cpp b/Userland/Services/LookupServer/MulticastDNS.cpp
index 15472b0310..7499391a63 100644
--- a/Userland/Services/LookupServer/MulticastDNS.cpp
+++ b/Userland/Services/LookupServer/MulticastDNS.cpp
@@ -11,7 +11,7 @@
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <limits.h>
#include <poll.h>
@@ -119,7 +119,7 @@ ErrorOr<size_t> MulticastDNS::emit_packet(Packet const& packet, sockaddr_in cons
Vector<IPv4Address> MulticastDNS::local_addresses() const
{
- auto file = Core::File::construct("/sys/kernel/net/adapters");
+ auto file = Core::DeprecatedFile::construct("/sys/kernel/net/adapters");
if (!file->open(Core::OpenMode::ReadOnly)) {
dbgln("Failed to open /sys/kernel/net/adapters: {}", file->error_string());
return {};
diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp
index 6ede99f447..6e4ba5d7a1 100644
--- a/Userland/Services/NetworkServer/main.cpp
+++ b/Userland/Services/NetworkServer/main.cpp
@@ -10,7 +10,6 @@
#include <LibCore/Command.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <unistd.h>
diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp
index d484b4fae7..56590f0d9e 100644
--- a/Userland/Services/SystemServer/Service.cpp
+++ b/Userland/Services/SystemServer/Service.cpp
@@ -12,8 +12,8 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/SessionManagement.h>
#include <LibCore/SocketAddress.h>
#include <LibCore/System.h>
@@ -123,7 +123,7 @@ ErrorOr<void> Service::activate()
ErrorOr<void> Service::spawn(int socket_fd)
{
- if (!Core::File::exists(m_executable_path)) {
+ if (!Core::DeprecatedFile::exists(m_executable_path)) {
dbgln("{}: binary \"{}\" does not exist, skipping service.", name(), m_executable_path);
return Error::from_errno(ENOENT);
}
diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp
index b27f138d25..6b8c77cba2 100644
--- a/Userland/Services/SystemServer/main.cpp
+++ b/Userland/Services/SystemServer/main.cpp
@@ -13,10 +13,10 @@
#include <Kernel/API/DeviceEvent.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <errno.h>
@@ -72,7 +72,7 @@ static ErrorOr<void> determine_system_mode()
g_system_mode = "text";
});
- auto f = Core::File::construct("/sys/kernel/system_mode");
+ auto f = Core::DeprecatedFile::construct("/sys/kernel/system_mode");
if (!f->open(Core::OpenMode::ReadOnly)) {
dbgln("Failed to read system_mode: {}", f->error_string());
// Continue and assume "text" mode.
@@ -188,7 +188,7 @@ static ErrorOr<void> populate_devtmpfs_char_devices_based_on_sysfs()
static ErrorOr<void> populate_devtmpfs_devices_based_on_devctl()
{
- auto f = Core::File::construct("/dev/devctl");
+ auto f = Core::DeprecatedFile::construct("/dev/devctl");
if (!f->open(Core::OpenMode::ReadOnly)) {
warnln("Failed to open /dev/devctl - {}", f->error_string());
VERIFY_NOT_REACHED();
diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp
index fceae0fd2a..ca8a07e3b8 100644
--- a/Userland/Services/TelnetServer/main.cpp
+++ b/Userland/Services/TelnetServer/main.cpp
@@ -9,8 +9,8 @@
#include <AK/HashMap.h>
#include <AK/Types.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/TCPServer.h>
#include <LibMain/Main.h>
#include <fcntl.h>
diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp
index dda03d5330..a19831cf80 100644
--- a/Userland/Services/WebContent/main.cpp
+++ b/Userland/Services/WebContent/main.cpp
@@ -5,8 +5,8 @@
*/
#include "ImageCodecPluginSerenity.h"
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/LocalServer.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
@@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
// This must be first; we can't check if /tmp/webdriver exists once we've unveiled other paths.
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
- if (Core::File::exists(webdriver_socket_path))
+ if (Core::DeprecatedFile::exists(webdriver_socket_path))
TRY(Core::System::unveil(webdriver_socket_path, "rw"sv));
TRY(Core::System::unveil("/res", "r"));
diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp
index beb497438b..5e06d22338 100644
--- a/Userland/Services/WebServer/Client.cpp
+++ b/Userland/Services/WebServer/Client.cpp
@@ -14,8 +14,8 @@
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <LibCore/DateTime.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/MimeData.h>
#include <LibHTTP/HttpRequest.h>
@@ -132,7 +132,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
path_builder.append(requested_path);
auto real_path = TRY(path_builder.to_string());
- if (Core::File::is_directory(real_path.bytes_as_string_view())) {
+ if (Core::DeprecatedFile::is_directory(real_path.bytes_as_string_view())) {
if (!resource_decoded.ends_with('/')) {
StringBuilder red;
@@ -147,14 +147,14 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
index_html_path_builder.append(real_path);
index_html_path_builder.append("/index.html"sv);
auto index_html_path = TRY(index_html_path_builder.to_string());
- if (!Core::File::exists(index_html_path)) {
+ if (!Core::DeprecatedFile::exists(index_html_path)) {
TRY(handle_directory_listing(requested_path, real_path, request));
return true;
}
real_path = index_html_path;
}
- auto file = Core::File::construct(real_path.bytes_as_string_view());
+ auto file = Core::DeprecatedFile::construct(real_path.bytes_as_string_view());
if (!file->open(Core::OpenMode::ReadOnly)) {
TRY(send_error_response(404, request));
return false;
@@ -169,7 +169,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
auto const info = ContentInfo {
.type = TRY(String::from_deprecated_string(Core::guess_mime_type_based_on_filename(real_path.bytes_as_string_view()))),
- .length = TRY(Core::File::size(real_path.bytes_as_string_view()))
+ .length = TRY(Core::DeprecatedFile::size(real_path.bytes_as_string_view()))
};
TRY(send_response(*stream, request, move(info)));
return true;
diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp
index dc6c6f3856..56ba18a2fa 100644
--- a/Userland/Services/WebServer/main.cpp
+++ b/Userland/Services/WebServer/main.cpp
@@ -8,8 +8,8 @@
#include <AK/String.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibCore/TCPServer.h>
@@ -56,8 +56,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 1;
}
- auto real_document_root_path = Core::File::real_path_for(document_root_path);
- if (!Core::File::exists(real_document_root_path)) {
+ auto real_document_root_path = Core::DeprecatedFile::real_path_for(document_root_path);
+ if (!Core::DeprecatedFile::exists(real_document_root_path)) {
warnln("Root path does not exist: '{}'", document_root_path);
return 1;
}
diff --git a/Userland/Services/WindowServer/KeymapSwitcher.cpp b/Userland/Services/WindowServer/KeymapSwitcher.cpp
index 92adcb0adb..68c7539182 100644
--- a/Userland/Services/WindowServer/KeymapSwitcher.cpp
+++ b/Userland/Services/WindowServer/KeymapSwitcher.cpp
@@ -6,7 +6,7 @@
#include <AK/JsonObject.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Process.h>
#include <WindowServer/KeymapSwitcher.h>
#include <spawn.h>
@@ -90,7 +90,7 @@ void KeymapSwitcher::next_keymap()
DeprecatedString KeymapSwitcher::get_current_keymap() const
{
- auto proc_keymap = Core::File::construct("/sys/kernel/keymap");
+ auto proc_keymap = Core::DeprecatedFile::construct("/sys/kernel/keymap");
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();
diff --git a/Userland/Services/WindowServer/main.cpp b/Userland/Services/WindowServer/main.cpp
index 57c3920a12..5fc766a26c 100644
--- a/Userland/Services/WindowServer/main.cpp
+++ b/Userland/Services/WindowServer/main.cpp
@@ -11,8 +11,8 @@
#include "WindowManager.h"
#include <Kernel/API/Graphics.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>
@@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
if (!path.starts_with("connector"sv))
continue;
auto full_path = DeprecatedString::formatted("/dev/gpu/{}", path);
- if (!Core::File::is_device(full_path))
+ if (!Core::DeprecatedFile::is_device(full_path))
continue;
auto display_connector_fd = TRY(Core::System::open(full_path, O_RDWR | O_CLOEXEC));
if (int rc = graphics_connector_set_responsible(display_connector_fd); rc != 0)
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp
index be2195db00..26fce6e092 100644
--- a/Userland/Shell/AST.cpp
+++ b/Userland/Shell/AST.cpp
@@ -12,8 +12,8 @@
#include <AK/ScopedValueRollback.h>
#include <AK/StringBuilder.h>
#include <AK/URL.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@@ -658,7 +658,7 @@ void BarewordLiteral::highlight_in_editor(Line::Editor& editor, Shell& shell, Hi
editor.stylize({ m_position.start_offset, m_position.end_offset }, { Line::Style::Foreground(Line::Style::XtermColor::Cyan) });
}
}
- if (Core::File::exists(m_text)) {
+ if (Core::DeprecatedFile::exists(m_text)) {
auto realpath = shell.resolve_path(m_text);
auto url = URL::create_with_file_scheme(realpath);
url.set_host(shell.hostname);
@@ -3053,7 +3053,7 @@ void Juxtaposition::highlight_in_editor(Line::Editor& editor, Shell& shell, High
path_builder.append(bareword_value);
auto path = path_builder.to_deprecated_string();
- if (Core::File::exists(path)) {
+ if (Core::DeprecatedFile::exists(path)) {
auto realpath = shell.resolve_path(path);
auto url = URL::create_with_file_scheme(realpath);
url.set_host(shell.hostname);
diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp
index ec45f90711..1c7268c938 100644
--- a/Userland/Shell/Builtin.cpp
+++ b/Userland/Shell/Builtin.cpp
@@ -12,8 +12,8 @@
#include <AK/ScopeGuard.h>
#include <AK/Statistics.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
@@ -61,7 +61,7 @@ static Vector<DeprecatedString> find_matching_executables_in_path(StringView fil
auto file = DeprecatedString::formatted("{}/{}", directory, filename);
if (follow_symlinks == FollowSymlinks::Yes) {
- auto path_or_error = Core::File::read_link(file);
+ auto path_or_error = Core::DeprecatedFile::read_link(file);
if (!path_or_error.is_error())
file = path_or_error.release_value();
}
@@ -332,7 +332,7 @@ int Shell::builtin_type(int argc, char const** argv)
}
// check if its an executable in PATH
- auto fullpath = Core::File::resolve_executable_from_environment(command);
+ auto fullpath = Core::DeprecatedFile::resolve_executable_from_environment(command);
if (fullpath.has_value()) {
printf("%s is %s\n", command.characters(), escape_token(fullpath.release_value()).characters());
continue;
@@ -372,7 +372,7 @@ int Shell::builtin_cd(int argc, char const** argv)
}
}
- auto real_path = Core::File::real_path_for(new_path);
+ auto real_path = Core::DeprecatedFile::real_path_for(new_path);
if (real_path.is_empty()) {
warnln("Invalid path '{}'", new_path);
return 1;
@@ -1175,7 +1175,7 @@ int Shell::builtin_kill(int argc, char const** argv)
{
// Simply translate the arguments and pass them to `kill'
Vector<DeprecatedString> replaced_values;
- auto kill_path = Core::File::resolve_executable_from_environment("kill"sv);
+ auto kill_path = Core::DeprecatedFile::resolve_executable_from_environment("kill"sv);
if (!kill_path.has_value()) {
warnln("kill: `kill' not found in PATH");
return 126;
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp
index fa349cb68f..3bbe927eed 100644
--- a/Userland/Shell/Shell.cpp
+++ b/Userland/Shell/Shell.cpp
@@ -19,10 +19,10 @@
#include <AK/StringBuilder.h>
#include <AK/TemporaryChange.h>
#include <AK/URL.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibCore/Timer.h>
@@ -220,7 +220,7 @@ Vector<DeprecatedString> Shell::expand_globs(StringView path, StringView base)
}
StringBuilder resolved_base_path_builder;
- resolved_base_path_builder.append(Core::File::real_path_for(base));
+ resolved_base_path_builder.append(Core::DeprecatedFile::real_path_for(base));
if (S_ISDIR(statbuf.st_mode))
resolved_base_path_builder.append('/');
@@ -337,7 +337,7 @@ DeprecatedString Shell::resolve_path(DeprecatedString path) const
if (!path.starts_with('/'))
path = DeprecatedString::formatted("{}/{}", cwd, path);
- return Core::File::real_path_for(path);
+ return Core::DeprecatedFile::real_path_for(path);
}
Shell::LocalFrame* Shell::find_frame_containing_local_variable(StringView name)
@@ -522,7 +522,7 @@ Optional<Shell::RunnablePath> Shell::runnable_path_for(StringView name)
auto parts = name.split_view('/');
auto path = name.to_deprecated_string();
if (parts.size() > 1) {
- auto file = Core::File::open(path.characters(), Core::OpenMode::ReadOnly);
+ auto file = Core::DeprecatedFile::open(path.characters(), Core::OpenMode::ReadOnly);
if (!file.is_error() && !file.value()->is_directory() && access(path.characters(), X_OK) == 0)
return RunnablePath { RunnablePath::Kind::Executable, name };
}
@@ -906,7 +906,7 @@ void Shell::execute_process(Vector<char const*>&& argv)
}
if (saved_errno == ENOENT) {
do {
- auto file_result = Core::File::open(argv[0], Core::OpenMode::ReadOnly);
+ auto file_result = Core::DeprecatedFile::open(argv[0], Core::OpenMode::ReadOnly);
if (file_result.is_error())
break;
auto& file = file_result.value();
@@ -1045,7 +1045,7 @@ bool Shell::run_file(DeprecatedString const& filename, bool explicitly_invoked)
TemporaryChange interactive_change { m_is_interactive, false };
TemporaryChange<Optional<SourcePosition>> source_change { m_source_position, SourcePosition { .source_file = filename, .literal_source_text = {}, .position = {} } };
- auto file_result = Core::File::open(filename, Core::OpenMode::ReadOnly);
+ auto file_result = Core::DeprecatedFile::open(filename, Core::OpenMode::ReadOnly);
if (file_result.is_error()) {
auto error = DeprecatedString::formatted("'{}': {}", escape_token_for_single_quotes(filename), file_result.error());
if (explicitly_invoked)
@@ -1364,7 +1364,7 @@ void Shell::cache_path()
cached_path.append({ RunnablePath::Kind::Alias, name });
}
- // TODO: Can we make this rely on Core::File::resolve_executable_from_environment()?
+ // TODO: Can we make this rely on Core::DeprecatedFile::resolve_executable_from_environment()?
DeprecatedString path = getenv("PATH");
if (!path.is_empty()) {
auto directories = path.split(':');
@@ -2391,7 +2391,7 @@ void Shell::possibly_print_error() const
i64 line_to_skip_to = max(source_position.position->start_line.line_number, 2ul) - 2;
if (!source_position.source_file.is_null()) {
- auto file = Core::File::open(source_position.source_file, Core::OpenMode::ReadOnly);
+ auto file = Core::DeprecatedFile::open(source_position.source_file, Core::OpenMode::ReadOnly);
if (file.is_error()) {
warnln("Shell: Internal error while trying to display source information: {} (while reading '{}')", file.error(), source_position.source_file);
return;
diff --git a/Userland/Shell/main.cpp b/Userland/Shell/main.cpp
index 5512d2240f..dc89853a1c 100644
--- a/Userland/Shell/main.cpp
+++ b/Userland/Shell/main.cpp
@@ -6,9 +6,9 @@
#include "Shell.h"
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <signal.h>
@@ -183,7 +183,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
parser.parse(arguments);
if (format) {
- auto file = TRY(Core::File::open(format, Core::OpenMode::ReadOnly));
+ auto file = TRY(Core::DeprecatedFile::open(format, Core::OpenMode::ReadOnly));
initialize();
@@ -224,7 +224,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
DeprecatedString file_path = name;
if (file_path.starts_with('~'))
file_path = shell->expand_tilde(file_path);
- if (Core::File::exists(file_path)) {
+ if (Core::DeprecatedFile::exists(file_path)) {
shell->run_file(file_path, false);
}
};
diff --git a/Userland/Utilities/abench.cpp b/Userland/Utilities/abench.cpp
index 7ad08b38c9..2920e05498 100644
--- a/Userland/Utilities/abench.cpp
+++ b/Userland/Utilities/abench.cpp
@@ -8,8 +8,8 @@
#include <AK/Types.h>
#include <LibAudio/Loader.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/ElapsedTimer.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
@@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
args_parser.add_option(sample_count, "How many samples to load at maximum", "sample-count", 's', "samples");
args_parser.parse(args);
- TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
+ TRY(Core::System::unveil(Core::DeprecatedFile::absolute_path(path), "r"sv));
TRY(Core::System::unveil(nullptr, nullptr));
TRY(Core::System::pledge("stdio recvfd rpath"));
diff --git a/Userland/Utilities/aplay.cpp b/Userland/Utilities/aplay.cpp
index 18d693de42..20884b1417 100644
--- a/Userland/Utilities/aplay.cpp
+++ b/Userland/Utilities/aplay.cpp
@@ -10,8 +10,8 @@
#include <LibAudio/Loader.h>
#include <LibAudio/Resampler.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <math.h>
@@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
TRY(Core::System::unveil("/tmp/session/%sid/portal/audio", "rw"));
- TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
+ TRY(Core::System::unveil(Core::DeprecatedFile::absolute_path(path), "r"sv));
TRY(Core::System::unveil(nullptr, nullptr));
Core::EventLoop loop;
diff --git a/Userland/Utilities/asctl.cpp b/Userland/Utilities/asctl.cpp
index 4bdb8eb1cd..0256423188 100644
--- a/Userland/Utilities/asctl.cpp
+++ b/Userland/Utilities/asctl.cpp
@@ -11,7 +11,6 @@
#include <LibAudio/ConnectionToServer.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <math.h>
diff --git a/Userland/Utilities/comm.cpp b/Userland/Utilities/comm.cpp
index 6d755298fb..370bdc4ea1 100644
--- a/Userland/Utilities/comm.cpp
+++ b/Userland/Utilities/comm.cpp
@@ -6,7 +6,7 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -68,7 +68,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return false;
}
- if (path != "-" && Core::File::is_directory(path)) {
+ if (path != "-" && Core::DeprecatedFile::is_directory(path)) {
warnln("Failed to open file{} '{}': is a directory", file_number, path);
return false;
}
diff --git a/Userland/Utilities/cp.cpp b/Userland/Utilities/cp.cpp
index 5c54408021..af26144087 100644
--- a/Userland/Utilities/cp.cpp
+++ b/Userland/Utilities/cp.cpp
@@ -6,7 +6,7 @@
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
@@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath wpath cpath fattr chown"));
bool link = false;
- auto preserve = Core::File::PreserveMode::Nothing;
+ auto preserve = Core::DeprecatedFile::PreserveMode::Nothing;
bool recursion_allowed = false;
bool verbose = false;
Vector<StringView> sources;
@@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
"attributes",
[&preserve](char const* s) {
if (!s) {
- preserve = Core::File::PreserveMode::Permissions | Core::File::PreserveMode::Ownership | Core::File::PreserveMode::Timestamps;
+ preserve = Core::DeprecatedFile::PreserveMode::Permissions | Core::DeprecatedFile::PreserveMode::Ownership | Core::DeprecatedFile::PreserveMode::Timestamps;
return true;
}
@@ -41,11 +41,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView { s, strlen(s) }.for_each_split_view(',', SplitBehavior::Nothing, [&](StringView value) {
if (value == "mode"sv) {
- preserve |= Core::File::PreserveMode::Permissions;
+ preserve |= Core::DeprecatedFile::PreserveMode::Permissions;
} else if (value == "ownership"sv) {
- preserve |= Core::File::PreserveMode::Ownership;
+ preserve |= Core::DeprecatedFile::PreserveMode::Ownership;
} else if (value == "timestamps"sv) {
- preserve |= Core::File::PreserveMode::Timestamps;
+ preserve |= Core::DeprecatedFile::PreserveMode::Timestamps;
} else {
warnln("cp: Unknown or unimplemented --preserve attribute: '{}'", value);
values_ok = false;
@@ -63,24 +63,24 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(destination, "Destination file path", "destination");
args_parser.parse(arguments);
- if (has_flag(preserve, Core::File::PreserveMode::Permissions)) {
+ if (has_flag(preserve, Core::DeprecatedFile::PreserveMode::Permissions)) {
umask(0);
} else {
TRY(Core::System::pledge("stdio rpath wpath cpath fattr"));
}
- bool destination_is_existing_dir = Core::File::is_directory(destination);
+ bool destination_is_existing_dir = Core::DeprecatedFile::is_directory(destination);
for (auto& source : sources) {
auto destination_path = destination_is_existing_dir
? DeprecatedString::formatted("{}/{}", destination, LexicalPath::basename(source))
: destination;
- auto result = Core::File::copy_file_or_directory(
+ auto result = Core::DeprecatedFile::copy_file_or_directory(
destination_path, source,
- recursion_allowed ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed,
- link ? Core::File::LinkMode::Allowed : Core::File::LinkMode::Disallowed,
- Core::File::AddDuplicateFileMarker::No,
+ recursion_allowed ? Core::DeprecatedFile::RecursionMode::Allowed : Core::DeprecatedFile::RecursionMode::Disallowed,
+ link ? Core::DeprecatedFile::LinkMode::Allowed : Core::DeprecatedFile::LinkMode::Disallowed,
+ Core::DeprecatedFile::AddDuplicateFileMarker::No,
preserve);
if (result.is_error()) {
diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp
index 4368ce3575..0e65262a56 100644
--- a/Userland/Utilities/functrace.cpp
+++ b/Userland/Utilities/functrace.cpp
@@ -10,7 +10,6 @@
#include <AK/StringBuilder.h>
#include <Kernel/API/SyscallString.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibDebug/DebugSession.h>
#include <LibELF/Image.h>
diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp
index dc24f31c6d..9004e841f6 100644
--- a/Userland/Utilities/grep.cpp
+++ b/Userland/Utilities/grep.cpp
@@ -11,8 +11,8 @@
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
while (it.has_next()) {
auto path = it.next_full_path();
- if (!Core::File::is_directory(path)) {
+ if (!Core::DeprecatedFile::is_directory(path)) {
auto key = user_has_specified_files ? path.view() : path.substring_view(base.length() + 1, path.length() - base.length() - 1);
if (auto result = handle_file(key, true); result.is_error() && !suppress_errors)
warnln("Failed with file {}: {}", key, result.release_error());
diff --git a/Userland/Utilities/groupdel.cpp b/Userland/Utilities/groupdel.cpp
index 9021fd64c2..03ade32609 100644
--- a/Userland/Utilities/groupdel.cpp
+++ b/Userland/Utilities/groupdel.cpp
@@ -8,7 +8,6 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <grp.h>
diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp
index de0783c099..9b08624b56 100644
--- a/Userland/Utilities/headless-browser.cpp
+++ b/Userland/Utilities/headless-browser.cpp
@@ -14,8 +14,8 @@
#include <AK/Types.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/ConfigFile.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibCore/SystemServerTakeover.h>
@@ -691,8 +691,8 @@ static void load_page_for_screenshot_and_exit(HeadlessBrowserPageClient& page_cl
DeprecatedString output_file_path = "output.png";
dbgln("Saving to {}", output_file_path);
- if (Core::File::exists(output_file_path))
- MUST(Core::File::remove(output_file_path, Core::File::RecursionMode::Disallowed));
+ if (Core::DeprecatedFile::exists(output_file_path))
+ MUST(Core::DeprecatedFile::remove(output_file_path, Core::DeprecatedFile::RecursionMode::Disallowed));
auto output_file = MUST(Core::Stream::File::open(output_file_path, Core::Stream::OpenMode::Write));
diff --git a/Userland/Utilities/ini.cpp b/Userland/Utilities/ini.cpp
index da82d076a6..19e92bb76b 100644
--- a/Userland/Utilities/ini.cpp
+++ b/Userland/Utilities/ini.cpp
@@ -6,7 +6,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(value_to_write, "Value to write", "value", Core::ArgsParser::Required::No);
args_parser.parse(arguments);
- if (!Core::File::exists(path)) {
+ if (!Core::DeprecatedFile::exists(path)) {
warnln("File does not exist: '{}'", path);
return 1;
}
diff --git a/Userland/Utilities/install.cpp b/Userland/Utilities/install.cpp
index c33331aca0..8afe3f50a4 100644
--- a/Userland/Utilities/install.cpp
+++ b/Userland/Utilities/install.cpp
@@ -7,8 +7,8 @@
#include <AK/LexicalPath.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/FilePermissionsMask.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
DeprecatedString destination_dir = (sources.size() > 1 ? DeprecatedString { destination } : LexicalPath::dirname(destination));
if (create_leading_dest_components) {
- DeprecatedString destination_dir_absolute = Core::File::absolute_path(destination_dir);
+ DeprecatedString destination_dir_absolute = Core::DeprecatedFile::absolute_path(destination_dir);
MUST(Core::Directory::create(destination_dir_absolute, Core::Directory::CreateDirectories::Yes));
}
@@ -47,9 +47,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
final_destination = destination;
}
- TRY(Core::File::copy_file_or_directory(final_destination, source, Core::File::RecursionMode::Allowed,
- Core::File::LinkMode::Disallowed, Core::File::AddDuplicateFileMarker::No,
- Core::File::PreserveMode::Nothing));
+ TRY(Core::DeprecatedFile::copy_file_or_directory(final_destination, source, Core::DeprecatedFile::RecursionMode::Allowed,
+ Core::DeprecatedFile::LinkMode::Disallowed, Core::DeprecatedFile::AddDuplicateFileMarker::No,
+ Core::DeprecatedFile::PreserveMode::Nothing));
auto current_access = TRY(Core::System::stat(final_destination));
TRY(Core::System::chmod(final_destination, permission_mask.apply(current_access.st_mode)));
diff --git a/Userland/Utilities/ldd.cpp b/Userland/Utilities/ldd.cpp
index 47fa61062b..972c267230 100644
--- a/Userland/Utilities/ldd.cpp
+++ b/Userland/Utilities/ldd.cpp
@@ -9,7 +9,6 @@
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibELF/DynamicLinker.h>
diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp
index 109ea0edb7..b41aec19d1 100644
--- a/Userland/Utilities/ls.cpp
+++ b/Userland/Utilities/ls.cpp
@@ -15,8 +15,8 @@
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DateTime.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <ctype.h>
@@ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
for (size_t i = 0; i < files.size(); i++) {
auto path = files[i].name;
- if (flag_recursive && Core::File::is_directory(path)) {
+ if (flag_recursive && Core::DeprecatedFile::is_directory(path)) {
size_t subdirs = 0;
Core::DirIterator di(path, Core::DirIterator::SkipParentAndBaseDir);
@@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
while (di.has_next()) {
DeprecatedString directory = di.next_full_path();
- if (Core::File::is_directory(directory) && !Core::File::is_link(directory)) {
+ if (Core::DeprecatedFile::is_directory(directory) && !Core::DeprecatedFile::is_link(directory)) {
++subdirs;
FileMetadata new_file;
new_file.name = move(directory);
@@ -184,7 +184,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
}
- bool show_dir_separator = files.size() > 1 && Core::File::is_directory(path) && !flag_list_directories_only;
+ bool show_dir_separator = files.size() > 1 && Core::DeprecatedFile::is_directory(path) && !flag_list_directories_only;
if (show_dir_separator) {
printf("%s:\n", path.characters());
}
@@ -237,7 +237,7 @@ static DeprecatedString& hostname()
static size_t print_name(const struct stat& st, DeprecatedString const& name, char const* path_for_link_resolution, char const* path_for_hyperlink)
{
if (!flag_disable_hyperlinks) {
- auto full_path = Core::File::real_path_for(path_for_hyperlink);
+ auto full_path = Core::DeprecatedFile::real_path_for(path_for_hyperlink);
if (!full_path.is_null()) {
auto url = URL::create_with_file_scheme(full_path, {}, hostname());
out("\033]8;;{}\033\\", url.serialize());
@@ -274,7 +274,7 @@ static size_t print_name(const struct stat& st, DeprecatedString const& name, ch
}
if (S_ISLNK(st.st_mode)) {
if (path_for_link_resolution) {
- auto link_destination_or_error = Core::File::read_link(path_for_link_resolution);
+ auto link_destination_or_error = Core::DeprecatedFile::read_link(path_for_link_resolution);
if (link_destination_or_error.is_error()) {
perror("readlink");
} else {
diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp
index 4ab40b9694..80546b0e6b 100644
--- a/Userland/Utilities/man.cpp
+++ b/Userland/Utilities/man.cpp
@@ -9,7 +9,6 @@
#include <AK/DeprecatedString.h>
#include <AK/Utf8View.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp
index 2259e20db4..55c45d2d75 100644
--- a/Userland/Utilities/markdown-check.cpp
+++ b/Userland/Utilities/markdown-check.cpp
@@ -19,7 +19,7 @@
#include <AK/URL.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibMain/Main.h>
#include <LibMarkdown/Document.h>
@@ -272,7 +272,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Since this should never happen anyway, fail early.
return 1;
}
- files.set(Core::File::real_path_for(path), MarkdownLinkage::analyze(*document));
+ files.set(Core::DeprecatedFile::real_path_for(path), MarkdownLinkage::analyze(*document));
}
outln("Checking links ...");
@@ -293,7 +293,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
} else {
pointee_file = LexicalPath::absolute_path(file_dir, file_link.file_path);
}
- if (!Core::File::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) {
+ if (!Core::DeprecatedFile::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) {
outln("File '{}' points to '{}' (label '{}'), but '{}' does not exist!",
file_item.key, file_link.file_path, file_link.label, pointee_file);
any_problems = true;
diff --git a/Userland/Utilities/mv.cpp b/Userland/Utilities/mv.cpp
index 772549f93f..4a30d350ff 100644
--- a/Userland/Utilities/mv.cpp
+++ b/Userland/Utilities/mv.cpp
@@ -7,7 +7,7 @@
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
@@ -69,17 +69,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
new_path = combined_new_path.characters();
}
- if (no_clobber && Core::File::exists(new_path))
+ if (no_clobber && Core::DeprecatedFile::exists(new_path))
continue;
rc = rename(old_path.characters(), new_path.characters());
if (rc < 0) {
if (errno == EXDEV) {
- auto result = Core::File::copy_file_or_directory(
+ auto result = Core::DeprecatedFile::copy_file_or_directory(
new_path, old_path,
- Core::File::RecursionMode::Allowed,
- Core::File::LinkMode::Disallowed,
- Core::File::AddDuplicateFileMarker::No);
+ Core::DeprecatedFile::RecursionMode::Allowed,
+ Core::DeprecatedFile::LinkMode::Disallowed,
+ Core::DeprecatedFile::AddDuplicateFileMarker::No);
if (result.is_error()) {
warnln("mv: could not move '{}': {}", old_path, static_cast<Error const&>(result.error()));
diff --git a/Userland/Utilities/open.cpp b/Userland/Utilities/open.cpp
index 72a7a75e8d..ef2ba4f614 100644
--- a/Userland/Utilities/open.cpp
+++ b/Userland/Utilities/open.cpp
@@ -8,8 +8,8 @@
#include <AK/URL.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibDesktop/Launcher.h>
#include <LibMain/Main.h>
@@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool all_ok = true;
for (auto& url_or_path : urls_or_paths) {
- auto path = Core::File::real_path_for(url_or_path);
+ auto path = Core::DeprecatedFile::real_path_for(url_or_path);
auto url = URL::create_with_url_or_path(path.is_null() ? url_or_path : path.view());
if (!Desktop::Launcher::open(url)) {
diff --git a/Userland/Utilities/pledge.cpp b/Userland/Utilities/pledge.cpp
index 230e1a5712..a056c6cd19 100644
--- a/Userland/Utilities/pledge.cpp
+++ b/Userland/Utilities/pledge.cpp
@@ -5,7 +5,7 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibELF/Image.h>
@@ -13,7 +13,7 @@
static ErrorOr<bool> is_dynamically_linked_executable(StringView filename)
{
- auto maybe_executable = Core::File::resolve_executable_from_environment(filename);
+ auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename);
if (!maybe_executable.has_value())
return ENOENT;
diff --git a/Userland/Utilities/pro.cpp b/Userland/Utilities/pro.cpp
index c02b266007..0f8b8dda3b 100644
--- a/Userland/Utilities/pro.cpp
+++ b/Userland/Utilities/pro.cpp
@@ -13,8 +13,8 @@
#include <AK/String.h>
#include <AK/URL.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibHTTP/HttpResponse.h>
#include <LibMain/Main.h>
@@ -339,7 +339,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (i > -1)
output_name = DeprecatedString::formatted("{}.{}", output_name, i);
++i;
- } while (Core::File::exists(output_name));
+ } while (Core::DeprecatedFile::exists(output_name));
}
int target_file_fd = open(output_name.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0644);
diff --git a/Userland/Utilities/readelf.cpp b/Userland/Utilities/readelf.cpp
index 74bb8f9d08..25d5cc525e 100644
--- a/Userland/Utilities/readelf.cpp
+++ b/Userland/Utilities/readelf.cpp
@@ -9,7 +9,6 @@
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibELF/DynamicLoader.h>
diff --git a/Userland/Utilities/readlink.cpp b/Userland/Utilities/readlink.cpp
index f32492676b..c2d1f09535 100644
--- a/Userland/Utilities/readlink.cpp
+++ b/Userland/Utilities/readlink.cpp
@@ -5,7 +5,7 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
for (auto path : paths) {
- auto destination = TRY(Core::File::read_link(path));
+ auto destination = TRY(Core::DeprecatedFile::read_link(path));
out("{}", destination);
if (!no_newline)
outln();
diff --git a/Userland/Utilities/rm.cpp b/Userland/Utilities/rm.cpp
index 15670ec53d..e2d026d5f1 100644
--- a/Userland/Utilities/rm.cpp
+++ b/Userland/Utilities/rm.cpp
@@ -7,7 +7,7 @@
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
@@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
continue;
}
- auto result = Core::File::remove(path, recursive ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed);
+ auto result = Core::DeprecatedFile::remove(path, recursive ? Core::DeprecatedFile::RecursionMode::Allowed : Core::DeprecatedFile::RecursionMode::Disallowed);
if (result.is_error()) {
auto error = result.release_error();
diff --git a/Userland/Utilities/run-tests.cpp b/Userland/Utilities/run-tests.cpp
index fa93cfaa46..eefc23b124 100644
--- a/Userland/Utilities/run-tests.cpp
+++ b/Userland/Utilities/run-tests.cpp
@@ -7,7 +7,7 @@
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/ConfigFile.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibCoredump/Backtrace.h>
#include <LibMain/Main.h>
@@ -365,12 +365,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
} else {
test_root = "/usr/Tests";
}
- if (!Core::File::is_directory(test_root)) {
+ if (!Core::DeprecatedFile::is_directory(test_root)) {
warnln("Test root is not a directory: {}", test_root);
return 1;
}
- test_root = Core::File::real_path_for(test_root);
+ test_root = Core::DeprecatedFile::real_path_for(test_root);
auto void_or_error = Core::System::chdir(test_root);
if (void_or_error.is_error()) {
diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp
index 624fde7921..3ecbfff3cb 100644
--- a/Userland/Utilities/shot.cpp
+++ b/Userland/Utilities/shot.cpp
@@ -11,7 +11,7 @@
#include <AK/URL.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DateTime.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Process.h>
#include <LibCore/Stream.h>
#include <LibGUI/Application.h>
@@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool printed_hyperlink = false;
if (isatty(STDOUT_FILENO)) {
- auto full_path = Core::File::real_path_for(output_path);
+ auto full_path = Core::DeprecatedFile::real_path_for(output_path);
if (!full_path.is_null()) {
char hostname[HOST_NAME_MAX];
VERIFY(gethostname(hostname, sizeof(hostname)) == 0);
diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp
index d4d630cbf2..9158cc793e 100644
--- a/Userland/Utilities/sql.cpp
+++ b/Userland/Utilities/sql.cpp
@@ -10,7 +10,7 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
#include <LibLine/Editor.h>
@@ -366,7 +366,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
SQLRepl repl(loop, database_name, move(sql_client));
- if (!suppress_sqlrc && Core::File::exists(sqlrc_path))
+ if (!suppress_sqlrc && Core::DeprecatedFile::exists(sqlrc_path))
repl.source_file(sqlrc_path);
if (!file_to_source.is_empty())
repl.source_file(file_to_source);
diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp
index 75fa1ff0fe..c7af350005 100644
--- a/Userland/Utilities/tar.cpp
+++ b/Userland/Utilities/tar.cpp
@@ -11,9 +11,9 @@
#include <LibArchive/TarStream.h>
#include <LibCompress/Gzip.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -150,7 +150,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
outln("{}", filename);
if (extract) {
- DeprecatedString absolute_path = Core::File::absolute_path(filename);
+ DeprecatedString absolute_path = Core::DeprecatedFile::absolute_path(filename);
auto parent_path = LexicalPath(absolute_path).parent();
auto header_mode = TRY(header.mode());
@@ -220,7 +220,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Archive::TarOutputStream tar_stream(move(output_stream));
auto add_file = [&](DeprecatedString path) -> ErrorOr<void> {
- auto file = Core::File::construct(path);
+ auto file = Core::DeprecatedFile::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
warnln("Failed to open {}: {}", path, file->error_string());
return {};
@@ -257,9 +257,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
while (it.has_next()) {
auto child_path = it.next_full_path();
- if (!dereference && Core::File::is_link(child_path)) {
+ if (!dereference && Core::DeprecatedFile::is_link(child_path)) {
TRY(add_link(child_path));
- } else if (!Core::File::is_directory(child_path)) {
+ } else if (!Core::DeprecatedFile::is_directory(child_path)) {
TRY(add_file(child_path));
} else {
TRY(handle_directory(child_path, handle_directory));
@@ -270,7 +270,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
for (auto const& path : paths) {
- if (Core::File::is_directory(path)) {
+ if (Core::DeprecatedFile::is_directory(path)) {
TRY(add_directory(path, add_directory));
} else {
TRY(add_file(path));
diff --git a/Userland/Utilities/test-imap.cpp b/Userland/Utilities/test-imap.cpp
index 0bd1555934..2211cf017a 100644
--- a/Userland/Utilities/test-imap.cpp
+++ b/Userland/Utilities/test-imap.cpp
@@ -5,8 +5,8 @@
*/
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
-#include <LibCore/File.h>
#include <LibCore/GetPassword.h>
#include <LibIMAP/Client.h>
#include <LibMain/Main.h>
@@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (interactive_password) {
password = TRY(Core::get_password());
} else {
- auto standard_input = Core::File::standard_input();
+ auto standard_input = Core::DeprecatedFile::standard_input();
password = Core::SecretString::take_ownership(standard_input->read_all());
}
diff --git a/Userland/Utilities/touch.cpp b/Userland/Utilities/touch.cpp
index 3b8691fcbc..41ff23113a 100644
--- a/Userland/Utilities/touch.cpp
+++ b/Userland/Utilities/touch.cpp
@@ -9,7 +9,7 @@
#include <AK/GenericLexer.h>
#include <AK/Time.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <LibTimeZone/TimeZone.h>
@@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
atime.tv_nsec = UTIME_OMIT;
for (auto path : paths) {
- if (Core::File::exists(path)) {
+ if (Core::DeprecatedFile::exists(path)) {
if (utimensat(AT_FDCWD, path.characters(), times, 0) == -1)
err("failed to touch '{}': {}", path, strerror(errno));
} else if (!no_create_file) {
diff --git a/Userland/Utilities/unveil.cpp b/Userland/Utilities/unveil.cpp
index ff026d384e..4683585a87 100644
--- a/Userland/Utilities/unveil.cpp
+++ b/Userland/Utilities/unveil.cpp
@@ -5,7 +5,6 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibELF/Image.h>
diff --git a/Userland/Utilities/unzip.cpp b/Userland/Utilities/unzip.cpp
index 3e9c9d3eea..3014ce503a 100644
--- a/Userland/Utilities/unzip.cpp
+++ b/Userland/Utilities/unzip.cpp
@@ -11,8 +11,8 @@
#include <LibArchive/Zip.h>
#include <LibCompress/Deflate.h>
#include <LibCore/ArgsParser.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibCrypto/Checksum/CRC32.h>
@@ -42,7 +42,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet)
return true;
}
MUST(Core::Directory::create(LexicalPath(zip_member.name.to_deprecated_string()).parent(), Core::Directory::CreateDirectories::Yes));
- auto new_file = Core::File::construct(zip_member.name.to_deprecated_string());
+ auto new_file = Core::DeprecatedFile::construct(zip_member.name.to_deprecated_string());
if (!new_file->open(Core::OpenMode::WriteOnly)) {
warnln("Can't write file {}: {}", zip_member.name, new_file->error_string());
return false;
@@ -94,7 +94,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet)
if (checksum.digest() != zip_member.crc32) {
warnln("Failed decompressing file {}: CRC32 mismatch", zip_member.name);
- MUST(Core::File::remove(zip_member.name, Core::File::RecursionMode::Disallowed));
+ MUST(Core::DeprecatedFile::remove(zip_member.name, Core::DeprecatedFile::RecursionMode::Disallowed));
return false;
}
diff --git a/Userland/Utilities/userdel.cpp b/Userland/Utilities/userdel.cpp
index 90e56ef845..a2aa9ae5b2 100644
--- a/Userland/Utilities/userdel.cpp
+++ b/Userland/Utilities/userdel.cpp
@@ -8,7 +8,7 @@
#include <AK/DeprecatedString.h>
#include <LibCore/Account.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <unistd.h>
@@ -47,14 +47,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (access(target_account.home_directory().characters(), F_OK) == -1)
return 0;
- auto const real_path = Core::File::real_path_for(target_account.home_directory());
+ auto const real_path = Core::DeprecatedFile::real_path_for(target_account.home_directory());
if (real_path == "/") {
warnln("home directory is /, not deleted!");
return 12;
}
- if (auto result = Core::File::remove(real_path, Core::File::RecursionMode::Allowed); result.is_error()) {
+ if (auto result = Core::DeprecatedFile::remove(real_path, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) {
warnln("{}", result.release_error());
return 12;
}
diff --git a/Userland/Utilities/usermod.cpp b/Userland/Utilities/usermod.cpp
index 5dce973db0..534560f9a3 100644
--- a/Userland/Utilities/usermod.cpp
+++ b/Userland/Utilities/usermod.cpp
@@ -6,7 +6,7 @@
#include <LibCore/Account.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <pwd.h>
@@ -103,11 +103,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto maybe_error = Core::System::rename(target_account.home_directory(), new_home_directory);
if (maybe_error.is_error()) {
if (maybe_error.error().code() == EXDEV) {
- auto result = Core::File::copy_file_or_directory(
+ auto result = Core::DeprecatedFile::copy_file_or_directory(
new_home_directory, target_account.home_directory().characters(),
- Core::File::RecursionMode::Allowed,
- Core::File::LinkMode::Disallowed,
- Core::File::AddDuplicateFileMarker::No);
+ Core::DeprecatedFile::RecursionMode::Allowed,
+ Core::DeprecatedFile::LinkMode::Disallowed,
+ Core::DeprecatedFile::AddDuplicateFileMarker::No);
if (result.is_error()) {
warnln("usermod: could not move directory {} : {}", target_account.home_directory().characters(), static_cast<Error const&>(result.error()));
diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp
index ae368f5888..5dababeb10 100644
--- a/Userland/Utilities/wasm.cpp
+++ b/Userland/Utilities/wasm.cpp
@@ -7,7 +7,6 @@
#include <AK/MemoryStream.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibLine/Editor.h>
#include <LibMain/Main.h>
diff --git a/Userland/Utilities/watch.cpp b/Userland/Utilities/watch.cpp
index 9adfbe68c0..b0f3051020 100644
--- a/Userland/Utilities/watch.cpp
+++ b/Userland/Utilities/watch.cpp
@@ -10,7 +10,7 @@
#include <AK/Time.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/FileWatcher.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@@ -163,7 +163,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file_watcher = Core::BlockingFileWatcher();
for (auto const& file : files_to_watch) {
- if (!Core::File::exists(file)) {
+ if (!Core::DeprecatedFile::exists(file)) {
warnln("Cannot watch '{}', it does not exist.", file);
return 1;
}
diff --git a/Userland/Utilities/which.cpp b/Userland/Utilities/which.cpp
index 96cceb0958..4403eb5abe 100644
--- a/Userland/Utilities/which.cpp
+++ b/Userland/Utilities/which.cpp
@@ -5,7 +5,7 @@
*/
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <stdio.h>
#include <unistd.h>
@@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(filename, "Name of executable", "executable");
args_parser.parse(arguments);
- auto fullpath = Core::File::resolve_executable_from_environment({ filename, strlen(filename) });
+ auto fullpath = Core::DeprecatedFile::resolve_executable_from_environment({ filename, strlen(filename) });
if (!fullpath.has_value()) {
warnln("no '{}' in path", filename);
return 1;
diff --git a/Userland/Utilities/xml.cpp b/Userland/Utilities/xml.cpp
index 6ccd0b9f6d..7be705dd6a 100644
--- a/Userland/Utilities/xml.cpp
+++ b/Userland/Utilities/xml.cpp
@@ -9,7 +9,7 @@
#include <AK/URL.h>
#include <AK/URLParser.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/File.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/Stream.h>
#include <LibMain/Main.h>
#include <LibXML/DOM/Document.h>
@@ -515,7 +515,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
parser.add_positional_argument(filename, "File to read from", "file");
parser.parse(arguments);
- s_path = Core::File::real_path_for(filename);
+ s_path = Core::DeprecatedFile::real_path_for(filename);
auto file = TRY(Core::Stream::File::open(s_path, Core::Stream::OpenMode::Read));
auto contents = TRY(file->read_until_eof());
diff --git a/Userland/Utilities/zip.cpp b/Userland/Utilities/zip.cpp
index 44d71acef6..7a9b88deff 100644
--- a/Userland/Utilities/zip.cpp
+++ b/Userland/Utilities/zip.cpp
@@ -10,8 +10,8 @@
#include <LibCompress/Deflate.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DateTime.h>
+#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
-#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibCrypto/Checksum/CRC32.h>
@@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil(nullptr, nullptr));
DeprecatedString zip_file_path { zip_path };
- if (Core::File::exists(zip_file_path)) {
+ if (Core::DeprecatedFile::exists(zip_file_path)) {
if (force) {
outln("{} already exists, overwriting...", zip_file_path);
} else {
@@ -107,9 +107,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
while (it.has_next()) {
auto child_path = it.next_full_path();
- if (Core::File::is_link(child_path))
+ if (Core::DeprecatedFile::is_link(child_path))
return {};
- if (!Core::File::is_directory(child_path)) {
+ if (!Core::DeprecatedFile::is_directory(child_path)) {
auto result = add_file(child_path);
if (result.is_error())
warnln("Couldn't add file '{}': {}", child_path, result.error());
@@ -123,7 +123,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
for (auto const& source_path : source_paths) {
- if (Core::File::is_directory(source_path)) {
+ if (Core::DeprecatedFile::is_directory(source_path)) {
auto result = add_directory(source_path, add_directory);
if (result.is_error())
warnln("Couldn't add directory '{}': {}", source_path, result.error());