mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	LibCore: Rename File to DeprecatedFile
				
					
				
			As usual, this removes many unused includes and moves used includes further down the chain.
This commit is contained in:
		
							parent
							
								
									14951b92ca
								
							
						
					
					
						commit
						d43a7eae54
					
				
					 193 changed files with 536 additions and 556 deletions
				
			
		|  | @ -26,12 +26,12 @@ and sets `errno` to describe the error. | ||||||
| ## Notes | ## Notes | ||||||
| 
 | 
 | ||||||
| The underlying system call always returns the full size of the target path on | 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 | 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. | 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 | 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. | instead. | ||||||
| 
 | 
 | ||||||
| ## Examples | ## 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: | version of `getpid(2)` which reads the calling process ID from ProcFS: | ||||||
| 
 | 
 | ||||||
| ```c++ | ```c++ | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| pid_t read_pid_using_readlink() | pid_t read_pid_using_readlink() | ||||||
|  | @ -55,7 +55,7 @@ pid_t read_pid_using_readlink() | ||||||
| 
 | 
 | ||||||
| pid_t read_pid_using_core_file() | 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()) |     if (target.is_null()) | ||||||
|         return -1; |         return -1; | ||||||
|     auto pid = target.to_uint(); |     auto pid = target.to_uint(); | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include <LibArchive/Tar.h> | #include <LibArchive/Tar.h> | ||||||
| #include <LibArchive/TarStream.h> | #include <LibArchive/TarStream.h> | ||||||
| #include <LibCore/Directory.h> | #include <LibCore/Directory.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/FileStream.h> | #include <LibCore/FileStream.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
|  | @ -68,7 +67,7 @@ ErrorOr<void> extract_tar_archive(DeprecatedString archive_file, DeprecatedStrin | ||||||
| { | { | ||||||
|     constexpr size_t buffer_size = 4096; |     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()); |     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()); |             path = path.prepend(header.prefix()); | ||||||
|         DeprecatedString filename = get_override("path"sv).value_or(path.string()); |         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(); |         auto parent_path = LexicalPath(absolute_path).parent(); | ||||||
| 
 | 
 | ||||||
|         switch (header.type_flag()) { |         switch (header.type_flag()) { | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include "Utilities.h" | #include "Utilities.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/Platform.h> | #include <AK/Platform.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <QCoreApplication> | #include <QCoreApplication> | ||||||
| 
 | 
 | ||||||
| DeprecatedString s_serenity_resource_root; | DeprecatedString s_serenity_resource_root; | ||||||
|  | @ -43,7 +43,7 @@ void platform_init() | ||||||
|         auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME"); |         auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME"); | ||||||
|         VERIFY(home); |         VERIFY(home); | ||||||
|         auto home_lagom = DeprecatedString::formatted("{}/.lagom", 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; |             return home_lagom; | ||||||
|         auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath()); |         auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath()); | ||||||
|         return LexicalPath(app_dir).parent().append("share"sv).string(); |         return LexicalPath(app_dir).parent().append("share"sv).string(); | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/LocalServer.h> | #include <LibCore/LocalServer.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibCore/SystemServerTakeover.h> | #include <LibCore/SystemServerTakeover.h> | ||||||
|  |  | ||||||
|  | @ -24,7 +24,6 @@ | ||||||
| #include <Kernel/API/KeyCode.h> | #include <Kernel/API/KeyCode.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/IODevice.h> | #include <LibCore/IODevice.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
|  |  | ||||||
|  | @ -13,8 +13,8 @@ | ||||||
| #include <Browser/CookieJar.h> | #include <Browser/CookieJar.h> | ||||||
| #include <Browser/Database.h> | #include <Browser/Database.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibGfx/Font/FontDatabase.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 { |     auto get_formatted_url = [&](StringView const& raw_url) -> URL { | ||||||
|         URL url = raw_url; |         URL url = raw_url; | ||||||
|         if (Core::File::exists(raw_url)) |         if (Core::DeprecatedFile::exists(raw_url)) | ||||||
|             url = URL::create_with_file_scheme(Core::File::real_path_for(raw_url)); |             url = URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(raw_url)); | ||||||
|         else if (!url.is_valid()) |         else if (!url.is_valid()) | ||||||
|             url = DeprecatedString::formatted("http://{}", raw_url); |             url = DeprecatedString::formatted("http://{}", raw_url); | ||||||
|         return url; |         return url; | ||||||
|  |  | ||||||
|  | @ -19,8 +19,8 @@ | ||||||
| #include <AK/SourceGenerator.h> | #include <AK/SourceGenerator.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| 
 | 
 | ||||||
| static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier) | 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); |     LexicalPath core_supplemental_path(core_path); | ||||||
|     core_supplemental_path = core_supplemental_path.append("supplemental"sv); |     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_core_aliases(core_supplemental_path.string(), cldr)); | ||||||
|     TRY(parse_likely_subtags(core_supplemental_path.string(), cldr)); |     TRY(parse_likely_subtags(core_supplemental_path.string(), cldr)); | ||||||
|  |  | ||||||
|  | @ -23,8 +23,8 @@ | ||||||
| #include <AK/Traits.h> | #include <AK/Traits.h> | ||||||
| #include <AK/Utf8View.h> | #include <AK/Utf8View.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h> | #include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h> | ||||||
| #include <LibLocale/Locale.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)); |     LexicalPath core_supplemental_path(move(core_path)); | ||||||
|     core_supplemental_path = core_supplemental_path.append("supplemental"sv); |     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)); |     TRY(parse_number_system_digits(core_supplemental_path.string(), cldr)); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <AK/Variant.h> | #include <AK/Variant.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibLocale/PluralRules.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)); |     LexicalPath core_supplemental_path(move(core_path)); | ||||||
|     core_supplemental_path = core_supplemental_path.append("supplemental"sv); |     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 remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr<DeprecatedString> { | ||||||
|         auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); |         auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); | ||||||
|  |  | ||||||
|  | @ -11,8 +11,8 @@ | ||||||
| #include <AK/StringUtils.h> | #include <AK/StringUtils.h> | ||||||
| #include <AK/Types.h> | #include <AK/Types.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Directory.h> | #include <LibCore/Directory.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibUnicode/Emoji.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()); |     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); |         emoji.image_path = move(path); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -340,7 +340,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|     args_parser.parse(arguments); |     args_parser.parse(arguments); | ||||||
| 
 | 
 | ||||||
|     auto emoji_test_file = TRY(open_file(emoji_test_path, Core::Stream::OpenMode::Read)); |     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 {}; |     EmojiData emoji_data {}; | ||||||
|     TRY(parse_emoji_test_data(*emoji_test_file, emoji_data)); |     TRY(parse_emoji_test_data(*emoji_test_file, emoji_data)); | ||||||
|  |  | ||||||
|  | @ -20,7 +20,6 @@ | ||||||
| #include <AK/Traits.h> | #include <AK/Traits.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibLocale/Locale.h> | #include <LibLocale/Locale.h> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| #include <AK/Debug.h> | #include <AK/Debug.h> | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibIDL/IDLParser.h> | #include <LibIDL/IDLParser.h> | ||||||
| #include <LibIDL/Types.h> | #include <LibIDL/Types.h> | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibCore/ConfigFile.h> | #include <LibCore/ConfigFile.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <spawn.h> | #include <spawn.h> | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include <sys/wait.h> | #include <sys/wait.h> | ||||||
|  | @ -231,7 +231,7 @@ int main() | ||||||
|         return 1; |         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()) |     if (current_working_directory.is_null()) | ||||||
|         return 1; |         return 1; | ||||||
|     auto lexical_cwd = LexicalPath(current_working_directory); |     auto lexical_cwd = LexicalPath(current_working_directory); | ||||||
|  | @ -241,7 +241,7 @@ int main() | ||||||
|         return 1; |         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("\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'"); |         warnln("       It can be generated by running CMake with 'cmake ../.. -G Ninja'"); | ||||||
|         return 1; |         return 1; | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| #include <AK/HashMap.h> | #include <AK/HashMap.h> | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| 
 | 
 | ||||||
| // Exit code is bitwise-or of these values:
 | // Exit code is bitwise-or of these values:
 | ||||||
| static constexpr auto EXIT_COLLISION = 0x1; | static constexpr auto EXIT_COLLISION = 0x1; | ||||||
|  | @ -25,7 +25,7 @@ int main(int argc, char** argv) | ||||||
|     bool had_errors = false; |     bool had_errors = false; | ||||||
|     for (int file_index = 1; file_index < argc; ++file_index) { |     for (int file_index = 1; file_index < argc; ++file_index) { | ||||||
|         DeprecatedString filename(argv[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()) { |         if (file_or_error.is_error()) { | ||||||
|             warnln("Error: Cannot open '{}': {}", filename, file_or_error.error()); |             warnln("Error: Cannot open '{}': {}", filename, file_or_error.error()); | ||||||
|             had_errors = true; |             had_errors = true; | ||||||
|  |  | ||||||
|  | @ -88,9 +88,9 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f | ||||||
| +}
 | +}
 | ||||||
| +
 | +
 | ||||||
| +#include <AK/JsonArray.h>
 | +#include <AK/JsonArray.h>
 | ||||||
|  | +#include <LibCore/DeprecatedFile.h>
 | ||||||
| +#include <LibCore/ProcessStatisticsReader.h>
 | +#include <LibCore/ProcessStatisticsReader.h>
 | ||||||
| +#include <LibCore/Stream.h>
 | +#include <LibCore/Stream.h>
 | ||||||
| +#include <LibCore/File.h>
 |  | ||||||
| +#include <stdio.h>
 | +#include <stdio.h>
 | ||||||
| +#include <string.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" {
 | +extern "C" {
 | ||||||
| +void os_initNative(JNIEnv *env, jclass clazz) {
 | +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,
 | +jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | @ -81,7 +81,7 @@ TEST_CASE(test_change_file_location) | ||||||
|     ftruncate(fd, 0); |     ftruncate(fd, 0); | ||||||
|     EXPECT(fchmod(fd, 06755) != -1); |     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()); |     EXPECT(!suid_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto suid_path = suid_path_or_error.release_value(); |     auto suid_path = suid_path_or_error.release_value(); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/Assertions.h> | #include <AK/Assertions.h> | ||||||
| #include <AK/Types.h> | #include <AK/Types.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | @ -217,7 +217,7 @@ TEST_CASE(unlink_symlink) | ||||||
|         perror("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()); |     EXPECT(!target_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto target = target_or_error.release_value(); |     auto target = target_or_error.release_value(); | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | @ -86,7 +86,7 @@ TEST_CASE(test_mkstemp_unique_filename) | ||||||
|         auto fd = mkstemp(path); |         auto fd = mkstemp(path); | ||||||
|         EXPECT_NE(fd, -1); |         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()); |         EXPECT(!temp_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|         auto temp_path = temp_path_or_error.release_value(); |         auto temp_path = temp_path_or_error.release_value(); | ||||||
|  | @ -107,7 +107,7 @@ TEST_CASE(test_mkstemp_unique_filename) | ||||||
|         auto fd = mkstemp(path); |         auto fd = mkstemp(path); | ||||||
|         EXPECT(fd != -1); |         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()); |         EXPECT(!path2_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|         auto path2 = path2_or_error.release_value(); |         auto path2 = path2_or_error.release_value(); | ||||||
|  | @ -132,7 +132,7 @@ TEST_CASE(test_mkstemps_unique_filename) | ||||||
|         auto fd = mkstemps(path, 6); |         auto fd = mkstemps(path, 6); | ||||||
|         EXPECT_NE(fd, -1); |         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()); |         EXPECT(!temp_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|         auto temp_path = temp_path_or_error.release_value(); |         auto temp_path = temp_path_or_error.release_value(); | ||||||
|  | @ -157,7 +157,7 @@ TEST_CASE(test_mkstemps_unique_filename) | ||||||
|         auto fd = mkstemps(path, 6); |         auto fd = mkstemps(path, 6); | ||||||
|         EXPECT(fd != -1); |         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()); |         EXPECT(!path2_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|         auto path2 = path2_or_error.release_value(); |         auto path2 = path2_or_error.release_value(); | ||||||
|  |  | ||||||
|  | @ -4,14 +4,14 @@ | ||||||
|  * SPDX-License-Identifier: BSD-2-Clause |  * SPDX-License-Identifier: BSD-2-Clause | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| static bool files_have_same_contents(DeprecatedString filename1, DeprecatedString filename2) | static bool files_have_same_contents(DeprecatedString filename1, DeprecatedString filename2) | ||||||
| { | { | ||||||
|     auto file1 = Core::File::open(filename1, Core::OpenMode::ReadOnly).value(); |     auto file1 = Core::DeprecatedFile::open(filename1, Core::OpenMode::ReadOnly).value(); | ||||||
|     auto file2 = Core::File::open(filename2, Core::OpenMode::ReadOnly).value(); |     auto file2 = Core::DeprecatedFile::open(filename2, Core::OpenMode::ReadOnly).value(); | ||||||
|     auto contents1 = file1->read_all(), contents2 = file2->read_all(); |     auto contents1 = file1->read_all(), contents2 = file2->read_all(); | ||||||
|     return contents1 == contents2; |     return contents1 == contents2; | ||||||
| } | } | ||||||
|  | @ -19,14 +19,14 @@ static bool files_have_same_contents(DeprecatedString filename1, DeprecatedStrin | ||||||
| TEST_CASE(file_readline) | TEST_CASE(file_readline) | ||||||
| { | { | ||||||
|     auto path = "long_lines.txt"; |     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()) { |     if (file_or_error.is_error()) { | ||||||
|         warnln("Failed to open {}: {}", path, file_or_error.error()); |         warnln("Failed to open {}: {}", path, file_or_error.error()); | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|     auto file = file_or_error.release_value(); |     auto file = file_or_error.release_value(); | ||||||
|     auto output_path = "/tmp/output.txt"; |     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(); |     auto outputfile = outfile_or_error.release_value(); | ||||||
|     while (file->can_read_line()) { |     while (file->can_read_line()) { | ||||||
|         outputfile->write(file->read_line()); |         outputfile->write(file->read_line()); | ||||||
|  | @ -41,7 +41,7 @@ TEST_CASE(file_readline) | ||||||
| TEST_CASE(file_get_read_position) | TEST_CASE(file_get_read_position) | ||||||
| { | { | ||||||
|     const DeprecatedString path = "10kb.txt"; |     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; |     const size_t step_size = 98; | ||||||
|     for (size_t i = 0; i < 10240 - step_size; i += step_size) { |     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) | TEST_CASE(file_lines_range) | ||||||
| { | { | ||||||
|     auto path = "long_lines.txt"; |     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()) { |     if (file_or_error.is_error()) { | ||||||
|         warnln("Failed to open {}: {}", path, file_or_error.error()); |         warnln("Failed to open {}: {}", path, file_or_error.error()); | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|     auto file = file_or_error.release_value(); |     auto file = file_or_error.release_value(); | ||||||
|     auto output_path = "/tmp/output.txt"; |     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(); |     auto outputfile = outfile_or_error.release_value(); | ||||||
|     for (auto line : file->lines()) { |     for (auto line : file->lines()) { | ||||||
|         outputfile->write(line); |         outputfile->write(line); | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
|  * SPDX-License-Identifier: BSD-2-Clause |  * SPDX-License-Identifier: BSD-2-Clause | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
| #include <elf.h> | #include <elf.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
|  | @ -58,7 +58,7 @@ TEST_CASE(test_interp_header_tiny_p_filesz) | ||||||
|     int nwritten = write(fd, buffer, sizeof(buffer)); |     int nwritten = write(fd, buffer, sizeof(buffer)); | ||||||
|     EXPECT(nwritten); |     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()); |     EXPECT(!elf_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto elf_path = elf_path_or_error.release_value(); |     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)); |     int nwritten = write(fd, buffer, sizeof(buffer)); | ||||||
|     EXPECT(nwritten); |     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()); |     EXPECT(!elf_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto elf_path = elf_path_or_error.release_value(); |     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)); |     int nwritten = write(fd, buffer, sizeof(buffer)); | ||||||
|     EXPECT(nwritten); |     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()); |     EXPECT(!elf_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto elf_path = elf_path_or_error.release_value(); |     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)); |     int nwritten = write(fd, buffer, sizeof(buffer)); | ||||||
|     EXPECT(nwritten); |     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()); |     EXPECT(!elf_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto elf_path = elf_path_or_error.release_value(); |     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)); |     int nwritten = write(fd, buffer, sizeof(buffer)); | ||||||
|     EXPECT(nwritten); |     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()); |     EXPECT(!elf_path_or_error.is_error()); | ||||||
| 
 | 
 | ||||||
|     auto elf_path = elf_path_or_error.release_value(); |     auto elf_path = elf_path_or_error.release_value(); | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ | ||||||
| #include <AK/QuickSort.h> | #include <AK/QuickSort.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Process.h> | #include <LibCore/Process.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
|  | @ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|     // Normalize the path to ensure filenames are consistent
 |     // Normalize the path to ensure filenames are consistent
 | ||||||
|     Vector<DeprecatedString> paths; |     Vector<DeprecatedString> paths; | ||||||
| 
 | 
 | ||||||
|     if (!Core::File::is_directory(test_directory)) { |     if (!Core::DeprecatedFile::is_directory(test_directory)) { | ||||||
|         paths.append(test_directory); |         paths.append(test_directory); | ||||||
|     } else { |     } else { | ||||||
|         Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) { |         Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) { | ||||||
|  |  | ||||||
|  | @ -6,8 +6,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/Base64.h> | #include <AK/Base64.h> | ||||||
| #include <LibCore/ConfigFile.h> | #include <LibCore/ConfigFile.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCrypto/ASN1/ASN1.h> | #include <LibCrypto/ASN1/ASN1.h> | ||||||
| #include <LibTLS/TLSv12.h> | #include <LibTLS/TLSv12.h> | ||||||
| #include <LibTest/TestCase.h> | #include <LibTest/TestCase.h> | ||||||
|  | @ -27,11 +27,11 @@ DeprecatedString locate_ca_certs_file(); | ||||||
| 
 | 
 | ||||||
| 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; |         return ca_certs_file; | ||||||
|     } |     } | ||||||
|     auto on_target_path = DeprecatedString("/etc/ca_certs.ini"); |     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 on_target_path; | ||||||
|     } |     } | ||||||
|     return ""; |     return ""; | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/Forward.h> | ||||||
| 
 | 
 | ||||||
| #include "Common.h" | #include "Common.h" | ||||||
| #include "Mesh.h" | #include "Mesh.h" | ||||||
|  | @ -18,5 +18,5 @@ public: | ||||||
|     MeshLoader() = default; |     MeshLoader() = default; | ||||||
|     virtual ~MeshLoader() = default; |     virtual ~MeshLoader() = default; | ||||||
| 
 | 
 | ||||||
|     virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) = 0; |     virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) = 0; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "WavefrontOBJLoader.h" | #include "WavefrontOBJLoader.h" | ||||||
| #include <AK/FixedArray.h> | #include <AK/FixedArray.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| 
 | 
 | ||||||
| static inline GLuint get_index_value(StringView& representation) | 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; |     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> vertices; | ||||||
|     Vector<Vertex> normals; |     Vector<Vertex> normals; | ||||||
|  |  | ||||||
|  | @ -18,5 +18,5 @@ public: | ||||||
|     WavefrontOBJLoader() = default; |     WavefrontOBJLoader() = default; | ||||||
|     ~WavefrontOBJLoader() override = default; |     ~WavefrontOBJLoader() override = default; | ||||||
| 
 | 
 | ||||||
|     ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) override; |     ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) override; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <LibCore/ElapsedTimer.h> | #include <LibCore/ElapsedTimer.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibFileSystemAccessClient/Client.h> | #include <LibFileSystemAccessClient/Client.h> | ||||||
| #include <LibGL/GL/gl.h> | #include <LibGL/GL/gl.h> | ||||||
|  | @ -34,7 +33,7 @@ class GLContextWidget final : public GUI::Frame { | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     bool load_path(DeprecatedString const& fname); |     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_x() { m_rotate_x = !m_rotate_x; } | ||||||
|     void toggle_rotate_y() { m_rotate_y = !m_rotate_y; } |     void toggle_rotate_y() { m_rotate_y = !m_rotate_y; } | ||||||
|     void toggle_rotate_z() { m_rotate_z = !m_rotate_z; } |     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) | 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) { |     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); |         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); |     return load_file(file); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool GLContextWidget::load_file(Core::File& file) | bool GLContextWidget::load_file(Core::DeprecatedFile& file) | ||||||
| { | { | ||||||
|     auto const& filename = file.filename(); |     auto const& filename = file.filename(); | ||||||
|     if (!filename.ends_with(".obj"sv)) { |     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(filename.split('.').at(0)); | ||||||
|     builder.append(".bmp"sv); |     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
 |     // Attempt to open the texture file from disk
 | ||||||
|     RefPtr<Gfx::Bitmap> texture_image; |     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); |         auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path); | ||||||
|         if (!bitmap_or_error.is_error()) |         if (!bitmap_or_error.is_error()) | ||||||
|             texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors(); |             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(); |         auto file = response.value(); | ||||||
|         if (widget->load_file(*file)) { |         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)); |             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"; |     auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj"; | ||||||
|     if (widget->load_path(filename)) { |     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)); |         window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/ElapsedTimer.h> | #include <LibCore/ElapsedTimer.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Process.h> | #include <LibCore/Process.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
|  | @ -23,6 +22,7 @@ | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <serenity.h> | #include <serenity.h> | ||||||
| #include <spawn.h> | #include <spawn.h> | ||||||
|  | #include <sys/stat.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| namespace Assistant { | namespace Assistant { | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ | ||||||
| #include <Applications/Browser/WindowActions.h> | #include <Applications/Browser/WindowActions.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/FileWatcher.h> | #include <LibCore/FileWatcher.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibCore/System.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 { |     auto url_from_argument_string = [](DeprecatedString const& string) -> URL { | ||||||
|         if (Core::File::exists(string)) { |         if (Core::DeprecatedFile::exists(string)) { | ||||||
|             return URL::create_with_file_scheme(Core::File::real_path_for(string)); |             return URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(string)); | ||||||
|         } |         } | ||||||
|         return Browser::url_from_user_input(string); |         return Browser::url_from_user_input(string); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <Applications/CrashReporter/CrashReporterWindowGML.h> | #include <Applications/CrashReporter/CrashReporterWindowGML.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibCoredump/Backtrace.h> | #include <LibCoredump/Backtrace.h> | ||||||
| #include <LibCoredump/Reader.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) | 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"); |         dbgln("Failed deleting coredump file"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "ThemePreviewWidget.h" | #include "ThemePreviewWidget.h" | ||||||
| #include <AK/Array.h> | #include <AK/Array.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/Painter.h> | #include <LibGUI/Painter.h> | ||||||
| #include <LibGfx/Painter.h> | #include <LibGfx/Painter.h> | ||||||
| #include <LibGfx/StylePainter.h> | #include <LibGfx/StylePainter.h> | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <LibCore/Account.h> | #include <LibCore/Account.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Desktop.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 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()) { |     if (!executable_path.has_value()) { | ||||||
|         GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0])); |         GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0])); | ||||||
|         return 127; |         return 127; | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| #include <AK/NumberFormat.h> | #include <AK/NumberFormat.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/MimeData.h> | #include <LibCore/MimeData.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibGUI/FileIconProvider.h> | #include <LibGUI/FileIconProvider.h> | ||||||
|  | @ -204,7 +204,7 @@ void DirectoryView::setup_model() | ||||||
| 
 | 
 | ||||||
|         while (model_root.string() != "/") { |         while (model_root.string() != "/") { | ||||||
|             model_root = model_root.parent(); |             model_root = model_root.parent(); | ||||||
|             if (Core::File::is_directory(model_root.string())) |             if (Core::DeprecatedFile::is_directory(model_root.string())) | ||||||
|                 break; |                 break; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -405,8 +405,8 @@ void DirectoryView::add_path_to_history(DeprecatedString path) | ||||||
| 
 | 
 | ||||||
| bool DirectoryView::open(DeprecatedString const& path) | bool DirectoryView::open(DeprecatedString const& path) | ||||||
| { | { | ||||||
|     auto real_path = Core::File::real_path_for(path); |     auto real_path = Core::DeprecatedFile::real_path_for(path); | ||||||
|     if (real_path.is_null() || !Core::File::is_directory(path)) |     if (real_path.is_null() || !Core::DeprecatedFile::is_directory(path)) | ||||||
|         return false; |         return false; | ||||||
| 
 | 
 | ||||||
|     if (chdir(real_path.characters()) < 0) { |     if (chdir(real_path.characters()) < 0) { | ||||||
|  | @ -555,7 +555,7 @@ bool DirectoryView::can_modify_current_selection() | ||||||
|     // FIXME: remove once Clang formats this properly.
 |     // FIXME: remove once Clang formats this properly.
 | ||||||
|     // clang-format off
 |     // clang-format off
 | ||||||
|     return selections.first_matching([&](auto& index) { |     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(); |     }).has_value(); | ||||||
|     // clang-format on
 |     // clang-format on
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "FileOperationProgressWidget.h" | #include "FileOperationProgressWidget.h" | ||||||
| #include "FileUtils.h" | #include "FileUtils.h" | ||||||
| #include <Applications/FileManager/FileOperationProgressGML.h> | #include <Applications/FileManager/FileOperationProgressGML.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Notifier.h> | #include <LibCore/Notifier.h> | ||||||
| #include <LibGUI/Button.h> | #include <LibGUI/Button.h> | ||||||
| #include <LibGUI/ImageWidget.h> | #include <LibGUI/ImageWidget.h> | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| #include "FileUtils.h" | #include "FileUtils.h" | ||||||
| #include "FileOperationProgressWidget.h" | #include "FileOperationProgressWidget.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/MimeData.h> | #include <LibCore/MimeData.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/System.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); |     auto const target = LexicalPath::canonicalized_path(destination); | ||||||
| 
 | 
 | ||||||
|     if (!Core::File::is_directory(target)) |     if (!Core::DeprecatedFile::is_directory(target)) | ||||||
|         return has_accepted_drop; |         return has_accepted_drop; | ||||||
| 
 | 
 | ||||||
|     Vector<DeprecatedString> paths_to_copy; |     Vector<DeprecatedString> paths_to_copy; | ||||||
|  |  | ||||||
|  | @ -10,6 +10,7 @@ | ||||||
| #include <AK/NumberFormat.h> | #include <AK/NumberFormat.h> | ||||||
| #include <Applications/FileManager/DirectoryView.h> | #include <Applications/FileManager/DirectoryView.h> | ||||||
| #include <Applications/FileManager/PropertiesWindowGeneralTabGML.h> | #include <Applications/FileManager/PropertiesWindowGeneralTabGML.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
|  | @ -102,7 +103,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) | ||||||
|     type->set_text(get_description(m_mode)); |     type->set_text(get_description(m_mode)); | ||||||
| 
 | 
 | ||||||
|     if (S_ISLNK(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()) { |         if (link_destination_or_error.is_error()) { | ||||||
|             perror("readlink"); |             perror("readlink"); | ||||||
|         } else { |         } else { | ||||||
|  | @ -214,7 +215,7 @@ bool PropertiesWindow::apply_changes() | ||||||
|         DeprecatedString new_name = m_name_box->text(); |         DeprecatedString new_name = m_name_box->text(); | ||||||
|         DeprecatedString new_file = make_full_path(new_name).characters(); |         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); |             GUI::MessageBox::show(this, DeprecatedString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error); | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <AK/Queue.h> | #include <AK/Queue.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/Button.h> | #include <LibGUI/Button.h> | ||||||
| #include <LibGUI/Dialog.h> | #include <LibGUI/Dialog.h> | ||||||
| #include <LibGUI/FileSystemModel.h> | #include <LibGUI/FileSystemModel.h> | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibConfig/Listener.h> | #include <LibConfig/Listener.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Process.h> | #include <LibCore/Process.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
|  | @ -107,14 +107,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
| 
 | 
 | ||||||
|     if (!initial_location.is_empty()) { |     if (!initial_location.is_empty()) { | ||||||
|         if (!ignore_path_resolution) |         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; |             is_selection_mode = true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (initial_location.is_empty()) |     if (initial_location.is_empty()) | ||||||
|         initial_location = Core::File::current_working_directory(); |         initial_location = Core::DeprecatedFile::current_working_directory(); | ||||||
| 
 | 
 | ||||||
|     if (initial_location.is_empty()) |     if (initial_location.is_empty()) | ||||||
|         initial_location = Core::StandardPaths::home_directory(); |         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 path = selected_file_paths.first(); | ||||||
|     auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path)); |     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::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv, | ||||||
|             GUI::MessageBox::Type::Error); |             GUI::MessageBox::Type::Error); | ||||||
|     } |     } | ||||||
|  | @ -456,7 +456,7 @@ ErrorOr<int> run_in_desktop_mode() | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         for (auto& path : 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)); |                 Desktop::Launcher::open(URL::create_with_file_scheme(path)); | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  | @ -469,7 +469,7 @@ ErrorOr<int> run_in_desktop_mode() | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         for (auto& path : paths) { |         for (auto& path : paths) { | ||||||
|             if (Core::File::is_directory(path)) { |             if (Core::DeprecatedFile::is_directory(path)) { | ||||||
|                 spawn_terminal(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(); |                     paths = directory_view->selected_file_paths(); | ||||||
| 
 | 
 | ||||||
|                 for (auto& path : 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)); |                         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(); |                     paths = directory_view->selected_file_paths(); | ||||||
| 
 | 
 | ||||||
|                 for (auto& path : paths) { |                 for (auto& path : paths) { | ||||||
|                     if (Core::File::is_directory(path)) { |                     if (Core::DeprecatedFile::is_directory(path)) { | ||||||
|                         spawn_terminal(path); |                         spawn_terminal(path); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  | @ -1090,7 +1090,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr | ||||||
|         if (!segment_index.has_value()) |         if (!segment_index.has_value()) | ||||||
|             return; |             return; | ||||||
|         auto selected_path = breadcrumbbar.segment_data(*segment_index); |         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); |             directory_view->open(selected_path); | ||||||
|         } else { |         } else { | ||||||
|             dbgln("Breadcrumb path '{}' doesn't exist", selected_path); |             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,
 |                 // If the path change was because the directory we were in was deleted,
 | ||||||
|                 // remove the breadcrumbs for it.
 |                 // remove the breadcrumbs for it.
 | ||||||
|                 if ((new_segment_index + 1 < breadcrumbbar.segment_count()) |                 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); |                     breadcrumbbar.remove_end_segments(new_segment_index + 1); | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <Applications/Help/HelpWindowGML.h> | #include <Applications/Help/HelpWindowGML.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
| #include <LibGUI/Action.h> | #include <LibGUI/Action.h> | ||||||
|  |  | ||||||
|  | @ -6,11 +6,13 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | #include <AK/HashMap.h> | ||||||
|  | #include <AK/NonnullOwnPtr.h> | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <AK/Time.h> | #include <AK/Time.h> | ||||||
| #include <AK/Types.h> | #include <AK/Types.h> | ||||||
| #include <AK/WeakPtr.h> | #include <AK/WeakPtr.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/Forward.h> | ||||||
| #include <LibGUI/Command.h> | #include <LibGUI/Command.h> | ||||||
| 
 | 
 | ||||||
| constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400); | constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400); | ||||||
|  |  | ||||||
|  | @ -11,8 +11,8 @@ | ||||||
| #include "ViewWidget.h" | #include "ViewWidget.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/MappedFile.h> | #include <LibCore/MappedFile.h> | ||||||
| #include <LibCore/MimeData.h> | #include <LibCore/MimeData.h> | ||||||
| #include <LibCore/Timer.h> | #include <LibCore/Timer.h> | ||||||
|  | @ -195,7 +195,7 @@ void ViewWidget::load_from_file(DeprecatedString const& path) | ||||||
|         m_timer->stop(); |         m_timer->stop(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     m_path = Core::File::real_path_for(path); |     m_path = Core::DeprecatedFile::real_path_for(path); | ||||||
|     reset_view(); |     reset_view(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,8 +12,8 @@ | ||||||
| #include <Applications/KeyboardSettings/KeyboardWidgetGML.h> | #include <Applications/KeyboardSettings/KeyboardWidgetGML.h> | ||||||
| #include <Applications/KeyboardSettings/KeymapDialogGML.h> | #include <Applications/KeyboardSettings/KeymapDialogGML.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/ComboBox.h> | #include <LibGUI/ComboBox.h> | ||||||
| #include <LibGUI/Dialog.h> | #include <LibGUI/Dialog.h> | ||||||
|  | @ -153,7 +153,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget() | ||||||
| { | { | ||||||
|     load_from_gml(keyboard_widget_gml).release_value_but_fixme_should_propagate_errors(); |     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)) |     if (!proc_keymap->open(Core::OpenMode::ReadOnly)) | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| #include <AK/JsonParser.h> | #include <AK/JsonParser.h> | ||||||
| #include <Applications/NetworkSettings/NetworkSettingsGML.h> | #include <Applications/NetworkSettings/NetworkSettingsGML.h> | ||||||
| #include <LibCore/Command.h> | #include <LibCore/Command.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/CheckBox.h> | #include <LibGUI/CheckBox.h> | ||||||
| #include <LibGUI/ComboBox.h> | #include <LibGUI/ComboBox.h> | ||||||
| #include <LibGUI/ItemListModel.h> | #include <LibGUI/ItemListModel.h> | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
| #include <LibGUI/MessageBox.h> | #include <LibGUI/MessageBox.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Icon.h> | #include <LibGUI/Icon.h> | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <AK/HashMap.h> | #include <AK/HashMap.h> | ||||||
| #include <AK/HashTable.h> | #include <AK/HashTable.h> | ||||||
| #include <AK/Variant.h> | #include <AK/Variant.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibFileSystemAccessClient/Client.h> | #include <LibFileSystemAccessClient/Client.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/BoxLayout.h> | #include <LibGUI/BoxLayout.h> | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/NumberFormat.h> | #include <AK/NumberFormat.h> | ||||||
| #include <Applications/PartitionEditor/PartitionModel.h> | #include <Applications/PartitionEditor/PartitionModel.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibPartition/EBRPartitionTable.h> | #include <LibPartition/EBRPartitionTable.h> | ||||||
| #include <LibPartition/GUIDPartitionTable.h> | #include <LibPartition/GUIDPartitionTable.h> | ||||||
| #include <LibPartition/MBRPartitionTable.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) | 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); |     auto mbr_table_or_error = Partition::MBRPartitionTable::try_to_initialize(file); | ||||||
|     if (!mbr_table_or_error.is_error()) { |     if (!mbr_table_or_error.is_error()) { | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <Applications/PartitionEditor/PartitionEditorWindowGML.h> | #include <Applications/PartitionEditor/PartitionEditorWindowGML.h> | ||||||
| #include <Applications/PartitionEditor/PartitionModel.h> | #include <Applications/PartitionEditor/PartitionModel.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
|  | @ -22,7 +23,7 @@ static Vector<DeprecatedString> get_device_paths() | ||||||
|     Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir); |     Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir); | ||||||
|     while (iterator.has_next()) { |     while (iterator.has_next()) { | ||||||
|         auto path = iterator.next_full_path(); |         auto path = iterator.next_full_path(); | ||||||
|         if (Core::File::is_block_device(path)) |         if (Core::DeprecatedFile::is_block_device(path)) | ||||||
|             device_paths.append(path); |             device_paths.append(path); | ||||||
|     } |     } | ||||||
|     return device_paths; |     return device_paths; | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <Applications/Run/RunGML.h> | #include <Applications/Run/RunGML.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibDesktop/Launcher.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); |     auto url = URL::create_with_url_or_path(run_input); | ||||||
| 
 | 
 | ||||||
|     if (url.scheme() == "file") { |     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()) { |         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)); |             warnln("Failed to launch '{}': {}", url.path(), strerror(errno)); | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "AlbumCoverVisualizationWidget.h" | #include "AlbumCoverVisualizationWidget.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibGUI/Painter.h> | #include <LibGUI/Painter.h> | ||||||
| #include <LibGfx/Rect.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 }; |     static constexpr auto possible_cover_filenames = Array { "cover.png"sv, "cover.jpg"sv }; | ||||||
|     for (auto& it : possible_cover_filenames) { |     for (auto& it : possible_cover_filenames) { | ||||||
|         LexicalPath cover_path = LexicalPath::join(directory, it); |         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()); |             return Gfx::Bitmap::load_from_file(cover_path.string()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "Player.h" | #include "Player.h" | ||||||
| #include <LibAudio/FlacLoader.h> | #include <LibAudio/FlacLoader.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| 
 | 
 | ||||||
| Player::Player(Audio::ConnectionToServer& audio_client_connection) | Player::Player(Audio::ConnectionToServer& audio_client_connection) | ||||||
|     : m_audio_client_connection(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()) |     if (path.is_null()) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     if (!Core::File::exists(path)) { |     if (!Core::DeprecatedFile::exists(path)) { | ||||||
|         audio_load_error(path, "File does not exist"sv); |         audio_load_error(path, "File does not exist"sv); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/Random.h> | #include <AK/Random.h> | ||||||
| #include <LibAudio/Loader.h> | #include <LibAudio/Loader.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibGUI/MessageBox.h> | #include <LibGUI/MessageBox.h> | ||||||
| 
 | 
 | ||||||
| bool Playlist::load(StringView path) | 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); |             entry.path = DeprecatedString::formatted("{}/{}", playlist_path.dirname(), entry.path); | ||||||
| 
 | 
 | ||||||
|         if (!entry.extended_info->file_size_in_bytes.has_value()) { |         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()) |             if (size.is_error()) | ||||||
|                 continue; |                 continue; | ||||||
|             entry.extended_info->file_size_in_bytes = size.value(); |             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); |             to_delete.append(&entry); | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h> | #include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/BoxLayout.h> | #include <LibGUI/BoxLayout.h> | ||||||
|  | @ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|         while (try_again) { |         while (try_again) { | ||||||
|             try_again = false; |             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()) { |             if (deletion_result.is_error()) { | ||||||
|                 auto retry_message_result = GUI::MessageBox::show(window, |                 auto retry_message_result = GUI::MessageBox::show(window, | ||||||
|                     DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?", |                     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); |         DeprecatedString selected_node_path = get_absolute_path_to_selected_node(tree_map_widget); | ||||||
|         if (selected_node_path.is_empty()) |         if (selected_node_path.is_empty()) | ||||||
|             return; |             return; | ||||||
|         delete_action->set_enabled(Core::File::can_delete_or_move(selected_node_path)); |         delete_action->set_enabled(Core::DeprecatedFile::can_delete_or_move(selected_node_path)); | ||||||
|         if (Core::File::is_directory(selected_node_path)) { |         if (Core::DeprecatedFile::is_directory(selected_node_path)) { | ||||||
|             open_folder_action->set_visible(true); |             open_folder_action->set_visible(true); | ||||||
|             open_containing_folder_action->set_visible(false); |             open_containing_folder_action->set_visible(false); | ||||||
|         } else { |         } else { | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <Applications/Spreadsheet/CSVImportGML.h> | #include <Applications/Spreadsheet/CSVImportGML.h> | ||||||
| #include <Applications/Spreadsheet/FormatSelectionPageGML.h> | #include <Applications/Spreadsheet/FormatSelectionPageGML.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/CheckBox.h> | #include <LibGUI/CheckBox.h> | ||||||
| #include <LibGUI/ComboBox.h> | #include <LibGUI/ComboBox.h> | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
| #include "../CSV.h" | #include "../CSV.h" | ||||||
| #include "../XSV.h" | #include "../XSV.h" | ||||||
| #include <AK/ByteBuffer.h> | #include <AK/ByteBuffer.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <string.h> | #include <string.h> | ||||||
| 
 | 
 | ||||||
| TEST_CASE(should_parse_valid_data) | TEST_CASE(should_parse_valid_data) | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
| #include <AK/TemporaryChange.h> | #include <AK/TemporaryChange.h> | ||||||
| #include <AK/URL.h> | #include <AK/URL.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibJS/Interpreter.h> | #include <LibJS/Interpreter.h> | ||||||
| #include <LibJS/Parser.h> | #include <LibJS/Parser.h> | ||||||
| #include <LibJS/Runtime/AbstractOperations.h> | #include <LibJS/Runtime/AbstractOperations.h> | ||||||
|  | @ -49,7 +49,7 @@ Sheet::Sheet(Workbook& workbook) | ||||||
| 
 | 
 | ||||||
|     // Sadly, these have to be evaluated once per sheet.
 |     // Sadly, these have to be evaluated once per sheet.
 | ||||||
|     constexpr auto runtime_file_path = "/res/js/Spreadsheet/runtime.js"sv; |     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()) { |     if (!file_or_error.is_error()) { | ||||||
|         auto buffer = file_or_error.value()->read_all(); |         auto buffer = file_or_error.value()->read_all(); | ||||||
|         auto script_or_error = JS::Script::parse(buffer, interpreter().realm(), runtime_file_path); |         auto script_or_error = JS::Script::parse(buffer, interpreter().realm(), runtime_file_path); | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
| #include <AK/Try.h> | #include <AK/Try.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibFileSystemAccessClient/Client.h> | #include <LibFileSystemAccessClient/Client.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
|  | @ -34,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|     args_parser.parse(arguments); |     args_parser.parse(arguments); | ||||||
| 
 | 
 | ||||||
|     if (filename) { |     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); |             warnln("File does not exist or is a directory: {}", filename); | ||||||
|             return 1; |             return 1; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include "GraphWidget.h" | #include "GraphWidget.h" | ||||||
| #include <AK/JsonObject.h> | #include <AK/JsonObject.h> | ||||||
| #include <AK/NumberFormat.h> | #include <AK/NumberFormat.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Object.h> | #include <LibCore/Object.h> | ||||||
| #include <LibGUI/BoxLayout.h> | #include <LibGUI/BoxLayout.h> | ||||||
| #include <LibGUI/Label.h> | #include <LibGUI/Label.h> | ||||||
|  | @ -104,7 +104,7 @@ static inline u64 page_count_to_bytes(size_t count) | ||||||
| 
 | 
 | ||||||
| void MemoryStatsWidget::refresh() | 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)) |     if (!proc_memstat->open(Core::OpenMode::ReadOnly)) | ||||||
|         VERIFY_NOT_REACHED(); |         VERIFY_NOT_REACHED(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| #include <AK/JsonValue.h> | #include <AK/JsonValue.h> | ||||||
| #include <AK/NonnullRefPtr.h> | #include <AK/NonnullRefPtr.h> | ||||||
| #include <AK/NumberFormat.h> | #include <AK/NumberFormat.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/ProcessStatisticsReader.h> | #include <LibCore/ProcessStatisticsReader.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibGUI/FileIconProvider.h> | #include <LibGUI/FileIconProvider.h> | ||||||
|  | @ -32,7 +32,7 @@ ProcessModel::ProcessModel() | ||||||
|     VERIFY(!s_the); |     VERIFY(!s_the); | ||||||
|     s_the = this; |     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)) { |     if (file->open(Core::OpenMode::ReadOnly)) { | ||||||
|         auto buffer = file->read_all(); |         auto buffer = file->read_all(); | ||||||
|         auto json = JsonValue::from_string({ buffer }); |         auto json = JsonValue::from_string({ buffer }); | ||||||
|  |  | ||||||
|  | @ -245,7 +245,7 @@ private: | ||||||
|     HashMap<int, NonnullRefPtr<Thread>> m_threads; |     HashMap<int, NonnullRefPtr<Thread>> m_threads; | ||||||
|     NonnullOwnPtrVector<Process> m_processes; |     NonnullOwnPtrVector<Process> m_processes; | ||||||
|     NonnullOwnPtrVector<CpuInfo> m_cpus; |     NonnullOwnPtrVector<CpuInfo> m_cpus; | ||||||
|     RefPtr<Core::File> m_proc_all; |     RefPtr<Core::DeprecatedFile> m_proc_all; | ||||||
|     GUI::Icon m_kernel_process_icon; |     GUI::Icon m_kernel_process_icon; | ||||||
|     u64 m_total_time_scheduled { 0 }; |     u64 m_total_time_scheduled { 0 }; | ||||||
|     u64 m_total_time_scheduled_kernel { 0 }; |     u64 m_total_time_scheduled_kernel { 0 }; | ||||||
|  |  | ||||||
|  | @ -10,8 +10,8 @@ | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibConfig/Listener.h> | #include <LibConfig/Listener.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
| #include <LibGUI/Action.h> | #include <LibGUI/Action.h> | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <Applications/TerminalSettings/TerminalSettingsViewGML.h> | #include <Applications/TerminalSettings/TerminalSettingsViewGML.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Button.h> | #include <LibGUI/Button.h> | ||||||
| #include <LibGUI/CheckBox.h> | #include <LibGUI/CheckBox.h> | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "FileArgument.h" | #include "FileArgument.h" | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibRegex/Regex.h> | #include <LibRegex/Regex.h> | ||||||
| 
 | 
 | ||||||
| namespace TextEditor { | namespace TextEditor { | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <Applications/TextEditor/TextEditorWindowGML.h> | #include <Applications/TextEditor/TextEditorWindowGML.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibCore/Debounce.h> | #include <LibCore/Debounce.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCpp/SyntaxHighlighter.h> | #include <LibCpp/SyntaxHighlighter.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
| #include <LibGUI/Action.h> | #include <LibGUI/Action.h> | ||||||
|  |  | ||||||
|  | @ -589,8 +589,8 @@ void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI:: | ||||||
|     bool open_folder = path_picker_target == PathPickerTarget::Folder; |     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 window_title = DeprecatedString::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name); | ||||||
|     auto target_path = path_input.text(); |     auto target_path = path_input.text(); | ||||||
|     if (Core::File::exists(target_path)) { |     if (Core::DeprecatedFile::exists(target_path)) { | ||||||
|         if (!Core::File::is_directory(target_path)) |         if (!Core::DeprecatedFile::is_directory(target_path)) | ||||||
|             target_path = LexicalPath::dirname(target_path); |             target_path = LexicalPath::dirname(target_path); | ||||||
|     } else { |     } else { | ||||||
|         target_path = "/res/icons"; |         target_path = "/res/icons"; | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|     Optional<DeprecatedString> path = {}; |     Optional<DeprecatedString> path = {}; | ||||||
| 
 | 
 | ||||||
|     if (!file_to_edit.is_empty()) |     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::pledge("stdio recvfd sendfd thread rpath unix")); | ||||||
|     TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw")); |     TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw")); | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <AK/RefPtr.h> | #include <AK/RefPtr.h> | ||||||
| #include <AK/Types.h> | #include <AK/Types.h> | ||||||
| #include <LibCore/ElapsedTimer.h> | #include <LibCore/ElapsedTimer.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibGUI/Menu.h> | #include <LibGUI/Menu.h> | ||||||
| #include <LibGUI/MouseTracker.h> | #include <LibGUI/MouseTracker.h> | ||||||
|  |  | ||||||
|  | @ -12,8 +12,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Directory.h> | #include <LibCore/Directory.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/BoxLayout.h> | #include <LibGUI/BoxLayout.h> | ||||||
| #include <LibGUI/Button.h> | #include <LibGUI/Button.h> | ||||||
| #include <LibGUI/FilePicker.h> | #include <LibGUI/FilePicker.h> | ||||||
|  | @ -150,7 +150,7 @@ Optional<DeprecatedString> NewProjectDialog::get_available_project_name() | ||||||
|             ? chosen_name |             ? chosen_name | ||||||
|             : DeprecatedString::formatted("{}-{}", chosen_name, i); |             : 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; |             return candidate; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -188,7 +188,7 @@ void NewProjectDialog::do_create_project() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto create_in = m_create_in_input->text(); |     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); |         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) |         if (result != GUI::MessageBox::ExecResult::Yes) | ||||||
|             return; |             return; | ||||||
|  |  | ||||||
|  | @ -15,8 +15,8 @@ | ||||||
| #include <AK/JsonParser.h> | #include <AK/JsonParser.h> | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibCore/Timer.h> | #include <LibCore/Timer.h> | ||||||
| #include <LibCpp/SemanticSyntaxHighlighter.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); |         Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots); | ||||||
|         while (it.has_next()) { |         while (it.has_next()) { | ||||||
|             auto path = it.next_full_path(); |             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); |                 auto key = path.substring(base.length() + 1, path.length() - base.length() - 1); | ||||||
|                 dbgln_if(EDITOR_DEBUG, "Adding header \"{}\" in path \"{}\"", key, path); |                 dbgln_if(EDITOR_DEBUG, "Adding header \"{}\" in path \"{}\"", key, path); | ||||||
|                 paths.set(key, path); |                 paths.set(key, path); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
| #include "GitWidget.h" | #include "GitWidget.h" | ||||||
| #include "../Dialogs/Git/GitCommitDialog.h" | #include "../Dialogs/Git/GitCommitDialog.h" | ||||||
| #include "GitFilesModel.h" | #include "GitFilesModel.h" | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibDiff/Format.h> | #include <LibDiff/Format.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
|  |  | ||||||
|  | @ -27,9 +27,9 @@ | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <Kernel/API/InodeWatcherEvent.h> | #include <Kernel/API/InodeWatcherEvent.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Event.h> | #include <LibCore/Event.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/FileWatcher.h> | #include <LibCore/FileWatcher.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibDebug/DebugSession.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())) { |     if (full_filename.starts_with(project().root_path())) { | ||||||
|         filename = LexicalPath::relative_path(full_filename, 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; |         return false; | ||||||
| 
 | 
 | ||||||
|     auto editor_wrapper_or_none = m_all_editor_wrappers.first_matching([&](auto& wrapper) { |     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; |         DeprecatedString filepath; | ||||||
| 
 | 
 | ||||||
|         if (!path_to_selected.is_empty()) { |         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()); |             LexicalPath selected(path_to_selected.first()); | ||||||
| 
 | 
 | ||||||
|             DeprecatedString dir_path; |             DeprecatedString dir_path; | ||||||
| 
 | 
 | ||||||
|             if (Core::File::is_directory(selected.string())) |             if (Core::DeprecatedFile::is_directory(selected.string())) | ||||||
|                 dir_path = selected.string(); |                 dir_path = selected.string(); | ||||||
|             else |             else | ||||||
|                 dir_path = selected.dirname(); |                 dir_path = selected.dirname(); | ||||||
|  | @ -574,7 +574,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio | ||||||
| 
 | 
 | ||||||
|             DeprecatedString dir_path; |             DeprecatedString dir_path; | ||||||
| 
 | 
 | ||||||
|             if (Core::File::is_directory(selected.string())) |             if (Core::DeprecatedFile::is_directory(selected.string())) | ||||||
|                 dir_path = selected.string(); |                 dir_path = selected.string(); | ||||||
|             else |             else | ||||||
|                 dir_path = selected.dirname(); |                 dir_path = selected.dirname(); | ||||||
|  | @ -682,7 +682,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action() | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             bool is_directory = S_ISDIR(st.st_mode); |             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(); |                 auto& error = result.error(); | ||||||
|                 if (is_directory) { |                 if (is_directory) { | ||||||
|                     GUI::MessageBox::show(window(), |                     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(), |         Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window(), | ||||||
|             old_filename.is_null() ? "Untitled"sv : old_path.title(), |             old_filename.is_null() ? "Untitled"sv : old_path.title(), | ||||||
|             old_filename.is_null() ? "txt"sv : old_path.extension(), |             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()) { |         if (!save_path.has_value()) { | ||||||
|             return; |             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)); |     auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"sv)); | ||||||
|     return GUI::Action::create("&Debug", icon, [this](auto&) { |     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); |             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; |             return; | ||||||
|         } |         } | ||||||
|  | @ -1245,7 +1245,7 @@ void HackStudioWidget::configure_project_tree_view() | ||||||
| 
 | 
 | ||||||
|         auto selections = m_project_tree_view->selection().indices(); |         auto selections = m_project_tree_view->selection().indices(); | ||||||
|         auto it = selections.find_if([&](auto selected_file) { |         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(); |         bool has_permissions = it != selections.end(); | ||||||
|         m_tree_view_rename_action->set_enabled(has_permissions); |         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; |         DeprecatedString formatted_error_string_holder; | ||||||
|         auto save_configuration_or_error = [&]() -> ErrorOr<void> { |         auto save_configuration_or_error = [&]() -> ErrorOr<void> { | ||||||
|             if (Core::File::exists(absolute_config_file_path)) |             if (Core::DeprecatedFile::exists(absolute_config_file_path)) | ||||||
|                 return {}; |                 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); |                 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); |                 return Error::from_string_view(formatted_error_string_holder); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| #include "ConnectionFromClient.h" | #include "ConnectionFromClient.h" | ||||||
| #include <AK/Debug.h> | #include <AK/Debug.h> | ||||||
| #include <AK/HashMap.h> | #include <AK/HashMap.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibGUI/TextDocument.h> | #include <LibGUI/TextDocument.h> | ||||||
| 
 | 
 | ||||||
| namespace LanguageServers { | namespace LanguageServers { | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "Project.h" | #include "Project.h" | ||||||
| #include "HackStudio.h" | #include "HackStudio.h" | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| 
 | 
 | ||||||
| namespace HackStudio { | namespace HackStudio { | ||||||
| 
 | 
 | ||||||
|  | @ -18,7 +18,7 @@ Project::Project(DeprecatedString const& root_path) | ||||||
| 
 | 
 | ||||||
| OwnPtr<Project> Project::open_with_root_path(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 {}; | ||||||
|     return adopt_own(*new Project(root_path)); |     return adopt_own(*new Project(root_path)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| #include "ProjectBuilder.h" | #include "ProjectBuilder.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/Command.h> | #include <LibCore/Command.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| #include <LibRegex/Regex.h> | #include <LibRegex/Regex.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
|  | @ -125,15 +125,15 @@ ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_p | ||||||
| 
 | 
 | ||||||
| ErrorOr<void> ProjectBuilder::initialize_build_directory() | 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)) { |         if (mkdir(LexicalPath::join(build_directory()).string().characters(), 0700)) { | ||||||
|             return Error::from_errno(errno); |             return Error::from_errno(errno); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt"sv).string(); |     auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt"sv).string(); | ||||||
|     if (Core::File::exists(cmake_file_path)) |     if (Core::DeprecatedFile::exists(cmake_file_path)) | ||||||
|         MUST(Core::File::remove(cmake_file_path, Core::File::RecursionMode::Disallowed)); |         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)); |     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())); |     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); |     auto directory = LexicalPath::dirname(file_path); | ||||||
|     while (!directory.is_empty()) { |     while (!directory.is_empty()) { | ||||||
|         auto cmake_path = LexicalPath::join(m_project_root, directory, "CMakeLists.txt"sv); |         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(); |             return cmake_path.string(); | ||||||
|         directory = LexicalPath::dirname(directory); |         directory = LexicalPath::dirname(directory); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -9,8 +9,8 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibCore/ConfigFile.h> | #include <LibCore/ConfigFile.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <spawn.h> | #include <spawn.h> | ||||||
| #include <sys/stat.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")); |     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); |         auto bitmap_or_error = Gfx::Bitmap::load_from_file(bitmap_path_32); | ||||||
|         if (!bitmap_or_error.is_error()) |         if (!bitmap_or_error.is_error()) | ||||||
|             icon = GUI::Icon(bitmap_or_error.release_value()); |             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) | Result<void, DeprecatedString> ProjectTemplate::create_project(DeprecatedString const& name, DeprecatedString const& path) | ||||||
| { | { | ||||||
|     // Check if a file or directory already exists at the project 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."); |         return DeprecatedString("File or directory already exists at specified location."); | ||||||
| 
 | 
 | ||||||
|     dbgln("Creating project at path '{}' with name '{}'", path, name); |     dbgln("Creating project at path '{}' with name '{}'", path, name); | ||||||
| 
 | 
 | ||||||
|     // Verify that the template content directory exists. If it does, copy it's contents.
 |     // Verify that the template content directory exists. If it does, copy it's contents.
 | ||||||
|     // Otherwise, create an empty directory at the project path.
 |     // Otherwise, create an empty directory at the project path.
 | ||||||
|     if (Core::File::is_directory(content_path())) { |     if (Core::DeprecatedFile::is_directory(content_path())) { | ||||||
|         auto result = Core::File::copy_file_or_directory(path, content_path()); |         auto result = Core::DeprecatedFile::copy_file_or_directory(path, content_path()); | ||||||
|         dbgln("Copying {} -> {}", content_path(), path); |         dbgln("Copying {} -> {}", content_path(), path); | ||||||
|         if (result.is_error()) |         if (result.is_error()) | ||||||
|             return DeprecatedString::formatted("Failed to copy template contents. Error code: {}", static_cast<Error const&>(result.error())); |             return DeprecatedString::formatted("Failed to copy template contents. Error code: {}", static_cast<Error const&>(result.error())); | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Menubar.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.add_option(mode_coredump, "Debug a coredump in HackStudio", "coredump", 'c'); | ||||||
|     args_parser.parse(arguments); |     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 (!mode_coredump) { | ||||||
|         if (!argument_absolute_path.is_null()) |         if (!argument_absolute_path.is_null()) | ||||||
|             project_path = argument_absolute_path; |             project_path = argument_absolute_path; | ||||||
|  | @ -143,7 +143,7 @@ static Optional<DeprecatedString> last_opened_project_path() | ||||||
|     if (projects.size() == 0) |     if (projects.size() == 0) | ||||||
|         return {}; |         return {}; | ||||||
| 
 | 
 | ||||||
|     if (!Core::File::exists(projects[0])) |     if (!Core::DeprecatedFile::exists(projects[0])) | ||||||
|         return {}; |         return {}; | ||||||
| 
 | 
 | ||||||
|     return { projects[0] }; |     return { projects[0] }; | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "Process.h" | #include "Process.h" | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| 
 | 
 | ||||||
| namespace Profiler { | namespace Profiler { | ||||||
| 
 | 
 | ||||||
|  | @ -93,7 +93,7 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co | ||||||
|         DeprecatedString full_path; |         DeprecatedString full_path; | ||||||
|         if (path_string.starts_with('/')) |         if (path_string.starts_with('/')) | ||||||
|             full_path = path_string; |             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); |             full_path = DeprecatedString::formatted("/usr/lib/{}", path); | ||||||
|         else |         else | ||||||
|             full_path = path_string; |             full_path = path_string; | ||||||
|  |  | ||||||
|  | @ -6,8 +6,8 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <DevTools/SQLStudio/SQLStudioGML.h> | #include <DevTools/SQLStudio/SQLStudioGML.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibDesktop/Launcher.h> | #include <LibDesktop/Launcher.h> | ||||||
| #include <LibGUI/Action.h> | #include <LibGUI/Action.h> | ||||||
|  | @ -45,7 +45,7 @@ static Vector<DeprecatedString> lookup_database_names() | ||||||
|     static constexpr auto database_extension = ".db"sv; |     static constexpr auto database_extension = ".db"sv; | ||||||
| 
 | 
 | ||||||
|     auto database_path = DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory()); |     auto database_path = DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory()); | ||||||
|     if (!Core::File::exists(database_path)) |     if (!Core::DeprecatedFile::exists(database_path)) | ||||||
|         return {}; |         return {}; | ||||||
| 
 | 
 | ||||||
|     Core::DirIterator iterator(move(database_path), Core::DirIterator::SkipParentAndBaseDir); |     Core::DirIterator iterator(move(database_path), Core::DirIterator::SkipParentAndBaseDir); | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/StringUtils.h> | #include <AK/StringUtils.h> | ||||||
| #include <Kernel/API/MemoryLayout.h> | #include <Kernel/API/MemoryLayout.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/MappedFile.h> | #include <LibCore/MappedFile.h> | ||||||
| #include <LibELF/AuxiliaryVector.h> | #include <LibELF/AuxiliaryVector.h> | ||||||
| #include <LibELF/Image.h> | #include <LibELF/Image.h> | ||||||
|  | @ -424,7 +423,7 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address) | ||||||
|         return {}; |         return {}; | ||||||
| 
 | 
 | ||||||
|     DeprecatedString lib_path = lib_name; |     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); |         lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_path); | ||||||
| 
 | 
 | ||||||
|     if (!m_dynamic_library_cache.contains(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); |     auto const* first_region = (lib_name.is_null() || lib_name.is_empty()) ? address_region : first_region_for_object(lib_name); | ||||||
|     VERIFY(first_region); |     VERIFY(first_region); | ||||||
|     auto lib_path = lib_name; |     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); |         lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_name); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibCore/ArgsParser.h> | #include <LibCore/ArgsParser.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Process.h> | #include <LibCore/Process.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <pthread.h> | #include <pthread.h> | ||||||
|  | @ -46,9 +45,9 @@ int main(int argc, char** argv, char** env) | ||||||
| 
 | 
 | ||||||
|     DeprecatedString executable_path; |     DeprecatedString executable_path; | ||||||
|     if (arguments[0].contains("/"sv)) |     if (arguments[0].contains("/"sv)) | ||||||
|         executable_path = Core::File::real_path_for(arguments[0]); |         executable_path = Core::DeprecatedFile::real_path_for(arguments[0]); | ||||||
|     else |     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()) { |     if (executable_path.is_empty()) { | ||||||
|         reportln("Cannot find executable for '{}'."sv, arguments[0]); |         reportln("Cannot find executable for '{}'."sv, arguments[0]); | ||||||
|         return 1; |         return 1; | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "Engine.h" | #include "Engine.h" | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <spawn.h> | #include <spawn.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  | @ -48,12 +48,12 @@ Engine::Engine(StringView command) | ||||||
|     close(wpipefds[0]); |     close(wpipefds[0]); | ||||||
|     close(rpipefds[1]); |     close(rpipefds[1]); | ||||||
| 
 | 
 | ||||||
|     auto infile = Core::File::construct(); |     auto infile = Core::DeprecatedFile::construct(); | ||||||
|     infile->open(rpipefds[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes); |     infile->open(rpipefds[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes); | ||||||
|     set_in(infile); |     set_in(infile); | ||||||
| 
 | 
 | ||||||
|     auto outfile = Core::File::construct(); |     auto outfile = Core::DeprecatedFile::construct(); | ||||||
|     outfile->open(wpipefds[1], Core::OpenMode::WriteOnly, Core::File::ShouldCloseFileDescriptor::Yes); |     outfile->open(wpipefds[1], Core::OpenMode::WriteOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes); | ||||||
|     set_out(outfile); |     set_out(outfile); | ||||||
| 
 | 
 | ||||||
|     send_command(Chess::UCI::UCICommand()); |     send_command(Chess::UCI::UCICommand()); | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ | ||||||
| #include <AK/Span.h> | #include <AK/Span.h> | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <LibAudio/Loader.h> | #include <LibAudio/Loader.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Stream.h> | #include <LibCore/Stream.h> | ||||||
| 
 | 
 | ||||||
| namespace Audio { | namespace Audio { | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <LibAudio/WavWriter.h> | #include <LibAudio/WavWriter.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| 
 | 
 | ||||||
| namespace Audio { | namespace Audio { | ||||||
| 
 | 
 | ||||||
|  | @ -31,7 +32,7 @@ WavWriter::~WavWriter() | ||||||
| 
 | 
 | ||||||
| void WavWriter::set_file(StringView path) | 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)) { |     if (!m_file->open(Core::OpenMode::ReadWrite)) { | ||||||
|         m_error_string = DeprecatedString::formatted("Can't open file: {}", m_file->error_string()); |         m_error_string = DeprecatedString::formatted("Can't open file: {}", m_file->error_string()); | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|  | @ -6,10 +6,13 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | #include <AK/DeprecatedString.h> | ||||||
| #include <AK/Noncopyable.h> | #include <AK/Noncopyable.h> | ||||||
|  | #include <AK/RefPtr.h> | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <LibAudio/Sample.h> | #include <LibAudio/Sample.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
|  | #include <LibCore/Forward.h> | ||||||
| 
 | 
 | ||||||
| namespace Audio { | namespace Audio { | ||||||
| 
 | 
 | ||||||
|  | @ -31,7 +34,7 @@ public: | ||||||
|     u32 sample_rate() const { return m_sample_rate; } |     u32 sample_rate() const { return m_sample_rate; } | ||||||
|     u16 num_channels() const { return m_num_channels; } |     u16 num_channels() const { return m_num_channels; } | ||||||
|     u16 bits_per_sample() const { return m_bits_per_sample; } |     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_file(StringView path); | ||||||
|     void set_num_channels(int num_channels) { m_num_channels = num_channels; } |     void set_num_channels(int num_channels) { m_num_channels = num_channels; } | ||||||
|  | @ -42,7 +45,7 @@ public: | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     void write_header(); |     void write_header(); | ||||||
|     RefPtr<Core::File> m_file; |     RefPtr<Core::DeprecatedFile> m_file; | ||||||
|     DeprecatedString m_error_string; |     DeprecatedString m_error_string; | ||||||
|     bool m_finalized { false }; |     bool m_finalized { false }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include <AK/ScopedValueRollback.h> | #include <AK/ScopedValueRollback.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <Kernel/API/Unveil.h> | #include <Kernel/API/Unveil.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <alloca.h> | #include <alloca.h> | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include <bits/pthread_cancel.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); |     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"); |     DeprecatedString path = getenv("PATH"); | ||||||
|     if (path.is_empty()) |     if (path.is_empty()) | ||||||
|         path = DEFAULT_PATH; |         path = DEFAULT_PATH; | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
| #include <AK/Debug.h> | #include <AK/Debug.h> | ||||||
| #include <AK/DeprecatedString.h> | #include <AK/DeprecatedString.h> | ||||||
| #include <LibCore/EventLoop.h> | #include <LibCore/EventLoop.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| 
 | 
 | ||||||
| namespace Chess::UCI { | namespace Chess::UCI { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,8 +9,8 @@ | ||||||
| #include <AK/HashTable.h> | #include <AK/HashTable.h> | ||||||
| #include <AK/OwnPtr.h> | #include <AK/OwnPtr.h> | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCpp/AST.h> | #include <LibCpp/AST.h> | ||||||
| #include <LibCpp/Lexer.h> | #include <LibCpp/Lexer.h> | ||||||
| #include <LibCpp/Parser.h> | #include <LibCpp/Parser.h> | ||||||
|  | @ -736,7 +736,7 @@ Optional<Vector<CodeComprehension::AutocompleteResultEntry>> CppComprehensionEng | ||||||
|         if (!path.starts_with(partial_basename)) |         if (!path.starts_with(partial_basename)) | ||||||
|             continue; |             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.
 |             // FIXME: Don't dismiss the autocomplete when filling these suggestions.
 | ||||||
|             auto completion = DeprecatedString::formatted("{}{}{}/", prefix, include_dir, path); |             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); |             options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path, CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No); | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| #include "../FileDB.h" | #include "../FileDB.h" | ||||||
| #include "CppComprehensionEngine.h" | #include "CppComprehensionEngine.h" | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibMain/Main.h> | #include <LibMain/Main.h> | ||||||
| 
 | 
 | ||||||
| static bool s_some_test_failed = false; | static bool s_some_test_failed = false; | ||||||
|  | @ -77,7 +77,7 @@ int run_tests() | ||||||
| 
 | 
 | ||||||
| static void add_file(FileDB& filedb, DeprecatedString const& name) | 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()); |     VERIFY(!file.is_error()); | ||||||
|     filedb.add(name, DeprecatedString::copy(file.value()->read_all())); |     filedb.add(name, DeprecatedString::copy(file.value()->read_all())); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <ConfigServer/ConfigClientEndpoint.h> | #include <ConfigServer/ConfigClientEndpoint.h> | ||||||
| #include <ConfigServer/ConfigServerEndpoint.h> | #include <ConfigServer/ConfigServerEndpoint.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Promise.h> | #include <LibCore/Promise.h> | ||||||
| #include <LibCore/StandardPaths.h> | #include <LibCore/StandardPaths.h> | ||||||
| #include <LibIPC/ConnectionToServer.h> | #include <LibIPC/ConnectionToServer.h> | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ set(SOURCES | ||||||
|     Command.cpp |     Command.cpp | ||||||
|     ConfigFile.cpp |     ConfigFile.cpp | ||||||
|     DateTime.cpp |     DateTime.cpp | ||||||
|  |     DeprecatedFile.cpp | ||||||
|     Directory.cpp |     Directory.cpp | ||||||
|     DirIterator.cpp |     DirIterator.cpp | ||||||
|     ElapsedTimer.cpp |     ElapsedTimer.cpp | ||||||
|     Event.cpp |     Event.cpp | ||||||
|     EventLoop.cpp |     EventLoop.cpp | ||||||
|     File.cpp |  | ||||||
|     IODevice.cpp |     IODevice.cpp | ||||||
|     LockFile.cpp |     LockFile.cpp | ||||||
|     MappedFile.cpp |     MappedFile.cpp | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| #include "Command.h" | #include "Command.h" | ||||||
| #include <AK/Format.h> | #include <AK/Format.h> | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <sys/wait.h> | #include <sys/wait.h> | ||||||
|  | @ -73,8 +73,8 @@ ErrorOr<CommandResult> command(DeprecatedString const& program, Vector<Deprecate | ||||||
|     close(stderr_pipe[1]); |     close(stderr_pipe[1]); | ||||||
| 
 | 
 | ||||||
|     auto read_all_from_pipe = [](int pipe[2]) { |     auto read_all_from_pipe = [](int pipe[2]) { | ||||||
|         auto result_file = Core::File::construct(); |         auto result_file = Core::DeprecatedFile::construct(); | ||||||
|         if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { |         if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes)) { | ||||||
|             perror("open"); |             perror("open"); | ||||||
|             VERIFY_NOT_REACHED(); |             VERIFY_NOT_REACHED(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -7,8 +7,8 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/Platform.h> | #include <AK/Platform.h> | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
|  | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/DirIterator.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
|  | @ -30,27 +30,27 @@ | ||||||
| 
 | 
 | ||||||
| namespace Core { | 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)) |     if (!file->open_impl(mode, permissions)) | ||||||
|         return Error::from_errno(file->error()); |         return Error::from_errno(file->error()); | ||||||
|     return file; |     return file; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| File::File(DeprecatedString filename, Object* parent) | DeprecatedFile::DeprecatedFile(DeprecatedString filename, Object* parent) | ||||||
|     : IODevice(parent) |     : IODevice(parent) | ||||||
|     , m_filename(move(filename)) |     , m_filename(move(filename)) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| File::~File() | DeprecatedFile::~DeprecatedFile() | ||||||
| { | { | ||||||
|     if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes && mode() != OpenMode::NotOpen) |     if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes && mode() != OpenMode::NotOpen) | ||||||
|         close(); |         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_fd(fd); | ||||||
|     set_mode(mode); |     set_mode(mode); | ||||||
|  | @ -58,12 +58,12 @@ bool File::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close) | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::open(OpenMode mode) | bool DeprecatedFile::open(OpenMode mode) | ||||||
| { | { | ||||||
|     return open_impl(mode, 0666); |     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()); |     VERIFY(!m_filename.is_null()); | ||||||
|     int flags = 0; |     int flags = 0; | ||||||
|  | @ -96,18 +96,18 @@ bool File::open_impl(OpenMode mode, mode_t permissions) | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int File::leak_fd() | int DeprecatedFile::leak_fd() | ||||||
| { | { | ||||||
|     m_should_close_file_descriptor = ShouldCloseFileDescriptor::No; |     m_should_close_file_descriptor = ShouldCloseFileDescriptor::No; | ||||||
|     return fd(); |     return fd(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_device() const | bool DeprecatedFile::is_device() const | ||||||
| { | { | ||||||
|     return is_device(fd()); |     return is_device(fd()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_device(DeprecatedString const& filename) | bool DeprecatedFile::is_device(DeprecatedString const& filename) | ||||||
| { | { | ||||||
|     struct stat st; |     struct stat st; | ||||||
|     if (stat(filename.characters(), &st) < 0) |     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); |     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; |     struct stat st; | ||||||
|     if (fstat(fd, &st) < 0) |     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); |     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; |     struct stat stat; | ||||||
|     if (fstat(fd(), &stat) < 0) |     if (fstat(fd(), &stat) < 0) | ||||||
|  | @ -131,7 +131,7 @@ bool File::is_block_device() const | ||||||
|     return S_ISBLK(stat.st_mode); |     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; |     struct stat st; | ||||||
|     if (stat(filename.characters(), &st) < 0) |     if (stat(filename.characters(), &st) < 0) | ||||||
|  | @ -139,7 +139,7 @@ bool File::is_block_device(DeprecatedString const& filename) | ||||||
|     return S_ISBLK(st.st_mode); |     return S_ISBLK(st.st_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_char_device() const | bool DeprecatedFile::is_char_device() const | ||||||
| { | { | ||||||
|     struct stat stat; |     struct stat stat; | ||||||
|     if (fstat(fd(), &stat) < 0) |     if (fstat(fd(), &stat) < 0) | ||||||
|  | @ -147,7 +147,7 @@ bool File::is_char_device() const | ||||||
|     return S_ISCHR(stat.st_mode); |     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; |     struct stat st; | ||||||
|     if (stat(filename.characters(), &st) < 0) |     if (stat(filename.characters(), &st) < 0) | ||||||
|  | @ -155,12 +155,12 @@ bool File::is_char_device(DeprecatedString const& filename) | ||||||
|     return S_ISCHR(st.st_mode); |     return S_ISCHR(st.st_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_directory() const | bool DeprecatedFile::is_directory() const | ||||||
| { | { | ||||||
|     return is_directory(fd()); |     return is_directory(fd()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_directory(DeprecatedString const& filename) | bool DeprecatedFile::is_directory(DeprecatedString const& filename) | ||||||
| { | { | ||||||
|     struct stat st; |     struct stat st; | ||||||
|     if (stat(filename.characters(), &st) < 0) |     if (stat(filename.characters(), &st) < 0) | ||||||
|  | @ -168,7 +168,7 @@ bool File::is_directory(DeprecatedString const& filename) | ||||||
|     return S_ISDIR(st.st_mode); |     return S_ISDIR(st.st_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_directory(int fd) | bool DeprecatedFile::is_directory(int fd) | ||||||
| { | { | ||||||
|     struct stat st; |     struct stat st; | ||||||
|     if (fstat(fd, &st) < 0) |     if (fstat(fd, &st) < 0) | ||||||
|  | @ -176,7 +176,7 @@ bool File::is_directory(int fd) | ||||||
|     return S_ISDIR(st.st_mode); |     return S_ISDIR(st.st_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_link() const | bool DeprecatedFile::is_link() const | ||||||
| { | { | ||||||
|     struct stat stat; |     struct stat stat; | ||||||
|     if (fstat(fd(), &stat) < 0) |     if (fstat(fd(), &stat) < 0) | ||||||
|  | @ -184,7 +184,7 @@ bool File::is_link() const | ||||||
|     return S_ISLNK(stat.st_mode); |     return S_ISLNK(stat.st_mode); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool File::is_link(DeprecatedString const& filename) | bool DeprecatedFile::is_link(DeprecatedString const& filename) | ||||||
| { | { | ||||||
|     struct stat st; |     struct stat st; | ||||||
|     if (lstat(filename.characters(), &st) < 0) |     if (lstat(filename.characters(), &st) < 0) | ||||||
|  | @ -192,17 +192,17 @@ bool File::is_link(DeprecatedString const& filename) | ||||||
|     return S_ISLNK(st.st_mode); |     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); |     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()); |     VERIFY(!path.is_empty()); | ||||||
|     auto directory = LexicalPath::dirname(path); |     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; |     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(); |     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; |     struct stat st; | ||||||
|     if (stat(filename.characters(), &st) < 0) |     if (stat(filename.characters(), &st) < 0) | ||||||
|  | @ -242,7 +242,7 @@ ErrorOr<size_t> File::size(DeprecatedString const& filename) | ||||||
|     return st.st_size; |     return st.st_size; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DeprecatedString File::real_path_for(DeprecatedString const& filename) | DeprecatedString DeprecatedFile::real_path_for(DeprecatedString const& filename) | ||||||
| { | { | ||||||
|     if (filename.is_null()) |     if (filename.is_null()) | ||||||
|         return {}; |         return {}; | ||||||
|  | @ -252,7 +252,7 @@ DeprecatedString File::real_path_for(DeprecatedString const& filename) | ||||||
|     return real_path; |     return real_path; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DeprecatedString File::current_working_directory() | DeprecatedString DeprecatedFile::current_working_directory() | ||||||
| { | { | ||||||
|     char* cwd = getcwd(nullptr, 0); |     char* cwd = getcwd(nullptr, 0); | ||||||
|     if (!cwd) { |     if (!cwd) { | ||||||
|  | @ -266,15 +266,15 @@ DeprecatedString File::current_working_directory() | ||||||
|     return cwd_as_string; |     return cwd_as_string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DeprecatedString File::absolute_path(DeprecatedString const& path) | DeprecatedString DeprecatedFile::absolute_path(DeprecatedString const& path) | ||||||
| { | { | ||||||
|     if (File::exists(path)) |     if (DeprecatedFile::exists(path)) | ||||||
|         return File::real_path_for(path); |         return DeprecatedFile::real_path_for(path); | ||||||
| 
 | 
 | ||||||
|     if (path.starts_with("/"sv)) |     if (path.starts_with("/"sv)) | ||||||
|         return LexicalPath::canonicalized_path(path); |         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); |     auto full_path = LexicalPath::join(working_directory, path); | ||||||
| 
 | 
 | ||||||
|     return LexicalPath::canonicalized_path(full_path.string()); |     return LexicalPath::canonicalized_path(full_path.string()); | ||||||
|  | @ -282,7 +282,7 @@ DeprecatedString File::absolute_path(DeprecatedString const& path) | ||||||
| 
 | 
 | ||||||
| #ifdef AK_OS_SERENITY | #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.
 |     // First, try using a 64-byte buffer, that ought to be enough for anybody.
 | ||||||
|     char small_buffer[64]; |     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
 | // 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.
 | // 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 = {}; |     struct stat statbuf = {}; | ||||||
|     int rc = lstat(link_path.characters(), &statbuf); |     int rc = lstat(link_path.characters(), &statbuf); | ||||||
|  | @ -341,32 +341,32 @@ ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path) | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static RefPtr<File> stdin_file; | static RefPtr<DeprecatedFile> stdin_file; | ||||||
| static RefPtr<File> stdout_file; | static RefPtr<DeprecatedFile> stdout_file; | ||||||
| static RefPtr<File> stderr_file; | static RefPtr<DeprecatedFile> stderr_file; | ||||||
| 
 | 
 | ||||||
| NonnullRefPtr<File> File::standard_input() | NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_input() | ||||||
| { | { | ||||||
|     if (!stdin_file) { |     if (!stdin_file) { | ||||||
|         stdin_file = File::construct(); |         stdin_file = DeprecatedFile::construct(); | ||||||
|         stdin_file->open(STDIN_FILENO, OpenMode::ReadOnly, ShouldCloseFileDescriptor::No); |         stdin_file->open(STDIN_FILENO, OpenMode::ReadOnly, ShouldCloseFileDescriptor::No); | ||||||
|     } |     } | ||||||
|     return *stdin_file; |     return *stdin_file; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| NonnullRefPtr<File> File::standard_output() | NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_output() | ||||||
| { | { | ||||||
|     if (!stdout_file) { |     if (!stdout_file) { | ||||||
|         stdout_file = File::construct(); |         stdout_file = DeprecatedFile::construct(); | ||||||
|         stdout_file->open(STDOUT_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); |         stdout_file->open(STDOUT_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); | ||||||
|     } |     } | ||||||
|     return *stdout_file; |     return *stdout_file; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| NonnullRefPtr<File> File::standard_error() | NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_error() | ||||||
| { | { | ||||||
|     if (!stderr_file) { |     if (!stderr_file) { | ||||||
|         stderr_file = File::construct(); |         stderr_file = DeprecatedFile::construct(); | ||||||
|         stderr_file->open(STDERR_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); |         stderr_file->open(STDERR_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); | ||||||
|     } |     } | ||||||
|     return *stderr_file; |     return *stderr_file; | ||||||
|  | @ -397,7 +397,7 @@ static DeprecatedString get_duplicate_name(DeprecatedString const& path, int dup | ||||||
|     return duplicated_name.to_deprecated_string(); |     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) { |     if (add_duplicate_file_marker == AddDuplicateFileMarker::Yes) { | ||||||
|         int duplicate_count = 0; |         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()) |     if (source_or_error.is_error()) | ||||||
|         return CopyError { errno, false }; |         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); |     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); |     int dst_fd = creat(dst_path.characters(), 0666); | ||||||
|     if (dst_fd < 0) { |     if (dst_fd < 0) { | ||||||
|  | @ -507,14 +507,14 @@ ErrorOr<void, File::CopyError> File::copy_file(DeprecatedString const& dst_path, | ||||||
|     return {}; |     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) |     if (mkdir(dst_path.characters(), 0755) < 0) | ||||||
|         return CopyError { errno, false }; |         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); |     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); |     dst_rp = DeprecatedString::formatted("{}/", dst_rp); | ||||||
| 
 | 
 | ||||||
|     if (!dst_rp.is_empty() && dst_rp.starts_with(src_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 {}; |     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; |     int duplicate_count = 0; | ||||||
|     while (access(get_duplicate_name(dst_path, duplicate_count).characters(), F_OK) == 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 {}; |     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)); |     auto path_stat = TRY(Core::System::lstat(path)); | ||||||
| 
 | 
 | ||||||
|  | @ -597,7 +597,7 @@ ErrorOr<void> File::remove(StringView path, RecursionMode mode) | ||||||
|     return {}; |     return {}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Optional<DeprecatedString> File::resolve_executable_from_environment(StringView filename) | Optional<DeprecatedString> DeprecatedFile::resolve_executable_from_environment(StringView filename) | ||||||
| { | { | ||||||
|     if (filename.is_empty()) |     if (filename.is_empty()) | ||||||
|         return {}; |         return {}; | ||||||
|  | @ -21,12 +21,12 @@ namespace Core { | ||||||
| /// Use of Core::File for reading/writing data is deprecated.
 | /// Use of Core::File for reading/writing data is deprecated.
 | ||||||
| /// Please use Core::Stream::File and Core::Stream::BufferedFile instead.
 | /// Please use Core::Stream::File and Core::Stream::BufferedFile instead.
 | ||||||
| ///
 | ///
 | ||||||
| class File final : public IODevice { | class DeprecatedFile final : public IODevice { | ||||||
|     C_OBJECT(File) |     C_OBJECT(DeprecatedFile) | ||||||
| public: | 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; } |     DeprecatedString filename() const { return m_filename; } | ||||||
|     void set_filename(const DeprecatedString filename) { m_filename = move(filename); } |     void set_filename(const DeprecatedString filename) { m_filename = move(filename); } | ||||||
|  | @ -86,7 +86,7 @@ public: | ||||||
|         bool tried_recursing; |         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_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); |     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); |     bool open(int fd, OpenMode, ShouldCloseFileDescriptor); | ||||||
|     [[nodiscard]] int leak_fd(); |     [[nodiscard]] int leak_fd(); | ||||||
| 
 | 
 | ||||||
|     static NonnullRefPtr<File> standard_input(); |     static NonnullRefPtr<DeprecatedFile> standard_input(); | ||||||
|     static NonnullRefPtr<File> standard_output(); |     static NonnullRefPtr<DeprecatedFile> standard_output(); | ||||||
|     static NonnullRefPtr<File> standard_error(); |     static NonnullRefPtr<DeprecatedFile> standard_error(); | ||||||
| 
 | 
 | ||||||
|     static Optional<DeprecatedString> resolve_executable_from_environment(StringView filename); |     static Optional<DeprecatedString> resolve_executable_from_environment(StringView filename); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     File(Object* parent = nullptr) |     DeprecatedFile(Object* parent = nullptr) | ||||||
|         : IODevice(parent) |         : IODevice(parent) | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
|     explicit File(DeprecatedString filename, Object* parent = nullptr); |     explicit DeprecatedFile(DeprecatedString filename, Object* parent = nullptr); | ||||||
| 
 | 
 | ||||||
|     bool open_impl(OpenMode, mode_t); |     bool open_impl(OpenMode, mode_t); | ||||||
| 
 | 
 | ||||||
|  | @ -124,6 +124,6 @@ private: | ||||||
|     ShouldCloseFileDescriptor m_should_close_file_descriptor { ShouldCloseFileDescriptor::Yes }; |     ShouldCloseFileDescriptor m_should_close_file_descriptor { ShouldCloseFileDescriptor::Yes }; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| AK_ENUM_BITWISE_OPERATORS(File::PreserveMode); | AK_ENUM_BITWISE_OPERATORS(DeprecatedFile::PreserveMode); | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | @ -14,12 +14,12 @@ class ChildEvent; | ||||||
| class ConfigFile; | class ConfigFile; | ||||||
| class CustomEvent; | class CustomEvent; | ||||||
| class DateTime; | class DateTime; | ||||||
|  | class DeprecatedFile; | ||||||
| class DirIterator; | class DirIterator; | ||||||
| class DeferredInvocationContext; | class DeferredInvocationContext; | ||||||
| class ElapsedTimer; | class ElapsedTimer; | ||||||
| class Event; | class Event; | ||||||
| class EventLoop; | class EventLoop; | ||||||
| class File; |  | ||||||
| class IODevice; | class IODevice; | ||||||
| class LocalServer; | class LocalServer; | ||||||
| class MimeData; | class MimeData; | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
| #include <AK/CharacterTypes.h> | #include <AK/CharacterTypes.h> | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibCore/File.h> |  | ||||||
| #include <LibCore/Group.h> | #include <LibCore/Group.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <LibCore/UmaskScope.h> | #include <LibCore/UmaskScope.h> | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ ErrorOr<NonnullOwnPtr<File>> File::adopt_fd(int fd, OpenMode mode, ShouldCloseFi | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!has_any_flag(mode, OpenMode::ReadWrite)) { |     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); |         return Error::from_errno(EINVAL); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ | ||||||
| #include <AK/ScopedValueRollback.h> | #include <AK/ScopedValueRollback.h> | ||||||
| #include <AK/StdLibExtras.h> | #include <AK/StdLibExtras.h> | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/SessionManagement.h> | #include <LibCore/SessionManagement.h> | ||||||
| #include <LibCore/System.h> | #include <LibCore/System.h> | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
|  | @ -1156,7 +1156,7 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear | ||||||
|     DeprecatedString exec_filename; |     DeprecatedString exec_filename; | ||||||
| 
 | 
 | ||||||
|     if (search_in_path == SearchInPath::Yes) { |     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()) |         if (!maybe_executable.has_value()) | ||||||
|             return ENOENT; |             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.
 |             // These BSDs don't support execvpe(), so we'll have to manually search the PATH.
 | ||||||
|             ScopedValueRollback errno_rollback(errno); |             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()) { |             if (!maybe_executable.has_value()) { | ||||||
|                 errno_rollback.set_override_rollback_value(ENOENT); |                 errno_rollback.set_override_rollback_value(ENOENT); | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "TempFile.h" | #include "TempFile.h" | ||||||
| #include <AK/Random.h> | #include <AK/Random.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
|  | @ -45,11 +45,11 @@ TempFile::TempFile(Type type) | ||||||
| 
 | 
 | ||||||
| TempFile::~TempFile() | TempFile::~TempFile() | ||||||
| { | { | ||||||
|     File::RecursionMode recursion_allowed { File::RecursionMode::Disallowed }; |     DeprecatedFile::RecursionMode recursion_allowed { DeprecatedFile::RecursionMode::Disallowed }; | ||||||
|     if (m_type == Type::Directory) |     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()) { |     if (rc.is_error()) { | ||||||
|         warnln("File::remove failed: {}", rc.error().string_literal()); |         warnln("File::remove failed: {}", rc.error().string_literal()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| #include <AK/Platform.h> | #include <AK/Platform.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <AK/Types.h> | #include <AK/Types.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/MappedFile.h> | #include <LibCore/MappedFile.h> | ||||||
| #include <LibCoredump/Backtrace.h> | #include <LibCoredump/Backtrace.h> | ||||||
| #include <LibCoredump/Reader.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()) |     if (maybe_ptr.has_value()) | ||||||
|         return *maybe_ptr; |         return *maybe_ptr; | ||||||
| 
 | 
 | ||||||
|     if (!Core::File::exists(path)) |     if (!Core::DeprecatedFile::exists(path)) | ||||||
|         return nullptr; |         return nullptr; | ||||||
| 
 | 
 | ||||||
|     auto file_or_error = Core::MappedFile::map(path); |     auto file_or_error = Core::MappedFile::map(path); | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| #include <AK/JsonValue.h> | #include <AK/JsonValue.h> | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <LibCompress/Gzip.h> | #include <LibCompress/Gzip.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCoredump/Reader.h> | #include <LibCoredump/Reader.h> | ||||||
| #include <signal.h> | #include <signal.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | @ -297,7 +297,7 @@ DeprecatedString Reader::resolve_object_path(StringView name) const | ||||||
|     //       (e.g. UserspaceEmulator, LibSymbolication, Profiler, and DynamicLinker itself)
 |     //       (e.g. UserspaceEmulator, LibSymbolication, Profiler, and DynamicLinker itself)
 | ||||||
|     //       We should consider creating unified implementation in the future.
 |     //       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; |         return name; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -108,13 +108,13 @@ TranslationUnit[0:0->144:0] | ||||||
|             [const] char |             [const] char | ||||||
|         output_filename |         output_filename | ||||||
|         NullPointerLiteral[21:34->21:40] |         NullPointerLiteral[21:34->21:40] | ||||||
|       VariableDeclaration[22:4->22:50] |       VariableDeclaration[22:4->22:60] | ||||||
|         NamedType[22:4->22:7] |         NamedType[22:4->22:7] | ||||||
|           auto |           auto | ||||||
|         trace_file |         trace_file | ||||||
|         FunctionCall[22:22->22:50] |         FunctionCall[22:22->22:60] | ||||||
|           Name[22:22->22:47] |           Name[22:22->22:57] | ||||||
|           Core::File::standard_error |           Core::DeprecatedFile::standard_error | ||||||
|       VariableDeclaration[24:4->24:27] |       VariableDeclaration[24:4->24:27] | ||||||
|         NamedType[24:4->24:19] |         NamedType[24:4->24:19] | ||||||
|           Core::ArgsParser |           Core::ArgsParser | ||||||
|  | @ -192,16 +192,16 @@ TranslationUnit[0:0->144:0] | ||||||
|           NullPointerLiteral[33:27->33:33] |           NullPointerLiteral[33:27->33:33] | ||||||
|         Then: |         Then: | ||||||
|         BlockStatement[33:36->42:4] |         BlockStatement[33:36->42:4] | ||||||
|           VariableDeclaration[34:8->34:87] |           VariableDeclaration[34:8->34:97] | ||||||
|             NamedType[34:8->34:11] |             NamedType[34:8->34:11] | ||||||
|               auto |               auto | ||||||
|             open_result |             open_result | ||||||
|             FunctionCall[34:27->34:87] |             FunctionCall[34:27->34:97] | ||||||
|               Name[34:27->34:42] |               Name[34:27->34:52] | ||||||
|               Core::File::open |               Core::DeprecatedFile::open | ||||||
|               Name[34:44->34:58] |               Name[34:54->34:68] | ||||||
|               output_filename |               output_filename | ||||||
|               Name[34:61->34:85] |               Name[34:71->34:95] | ||||||
|               Core::OpenMode::WriteOnly |               Core::OpenMode::WriteOnly | ||||||
|           IfStatement[35:8->39:8] |           IfStatement[35:8->39:8] | ||||||
|             Predicate: |             Predicate: | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ int main(int argc, char** argv) | ||||||
|     Vector<const char*> child_argv; |     Vector<const char*> child_argv; | ||||||
| 
 | 
 | ||||||
|     const char* output_filename = nullptr; |     const char* output_filename = nullptr; | ||||||
|     auto trace_file = Core::File::standard_error(); |     auto trace_file = Core::DeprecatedFile::standard_error(); | ||||||
| 
 | 
 | ||||||
|     Core::ArgsParser parser; |     Core::ArgsParser parser; | ||||||
|     parser.set_general_help( |     parser.set_general_help( | ||||||
|  | @ -32,7 +32,7 @@ int main(int argc, char** argv) | ||||||
|     parser.parse(argc, argv); |     parser.parse(argc, argv); | ||||||
| 
 | 
 | ||||||
|     if (output_filename != nullptr) { |     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()) { |         if (open_result.is_error()) { | ||||||
|             outln(stderr, "Failed to open output file: {}", open_result.error()); |             outln(stderr, "Failed to open output file: {}", open_result.error()); | ||||||
|             return 1; |             return 1; | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tim Schumacher
						Tim Schumacher