diff --git a/Ladybird/Android/src/main/cpp/RequestServerService.cpp b/Ladybird/Android/src/main/cpp/RequestServerService.cpp index 3856e2670e9..231db0e05f1 100644 --- a/Ladybird/Android/src/main/cpp/RequestServerService.cpp +++ b/Ladybird/Android/src/main/cpp/RequestServerService.cpp @@ -25,7 +25,7 @@ ErrorOr find_certificates(StringView serenity_resource_root) { auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root)); if (!FileSystem::exists(cert_path)) { - auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path()).to_deprecated_string()); + auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path())); cert_path = TRY(String::formatted("{}/cacert.pem", LexicalPath(app_dir).parent())); if (!FileSystem::exists(cert_path)) diff --git a/Ladybird/Android/src/main/cpp/WebSocketService.cpp b/Ladybird/Android/src/main/cpp/WebSocketService.cpp index aad52eb5cff..87f7516812d 100644 --- a/Ladybird/Android/src/main/cpp/WebSocketService.cpp +++ b/Ladybird/Android/src/main/cpp/WebSocketService.cpp @@ -21,7 +21,7 @@ ErrorOr find_certificates(StringView serenity_resource_root) { auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root)); if (!FileSystem::exists(cert_path)) { - auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path()).to_deprecated_string()); + auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path())); cert_path = TRY(String::formatted("{}/cacert.pem", LexicalPath(app_dir).parent())); if (!FileSystem::exists(cert_path)) diff --git a/Ladybird/RequestServer/main.cpp b/Ladybird/RequestServer/main.cpp index a0934eea9fa..8ac522fa4e5 100644 --- a/Ladybird/RequestServer/main.cpp +++ b/Ladybird/RequestServer/main.cpp @@ -25,7 +25,7 @@ ErrorOr find_certificates(StringView serenity_resource_root) { auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root)); if (!FileSystem::exists(cert_path)) { - auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path()).to_deprecated_string()); + auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path())); cert_path = TRY(String::formatted("{}/cacert.pem", LexicalPath(app_dir).parent())); if (!FileSystem::exists(cert_path)) diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp index dc65dbdeb83..5897abe7a34 100644 --- a/Ladybird/Utilities.cpp +++ b/Ladybird/Utilities.cpp @@ -17,7 +17,7 @@ DeprecatedString s_serenity_resource_root; ErrorOr application_directory() { auto current_executable_path = TRY(Core::System::current_executable_path()); - auto dirname = LexicalPath::dirname(current_executable_path.to_deprecated_string()); + auto dirname = LexicalPath::dirname(current_executable_path); return String::from_deprecated_string(dirname); } diff --git a/Ladybird/WebSocket/main.cpp b/Ladybird/WebSocket/main.cpp index 0e2de2395b9..783e2af26ed 100644 --- a/Ladybird/WebSocket/main.cpp +++ b/Ladybird/WebSocket/main.cpp @@ -21,7 +21,7 @@ ErrorOr find_certificates(StringView serenity_resource_root) { auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root)); if (!FileSystem::exists(cert_path)) { - auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path()).to_deprecated_string()); + auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path())); cert_path = TRY(String::formatted("{}/cacert.pem", LexicalPath(app_dir).parent())); if (!FileSystem::exists(cert_path)) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 08434654be9..f7de49ee62f 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1806,7 +1806,7 @@ char** environment() #endif } -ErrorOr current_executable_path() +ErrorOr current_executable_path() { char path[4096] = {}; #if defined(AK_OS_LINUX) || defined(AK_OS_ANDROID) || defined(AK_OS_SERENITY) @@ -1827,9 +1827,9 @@ ErrorOr current_executable_path() return Error::from_syscall("proc_get_exe"sv, -errno); } #elif defined(AK_OS_DRAGONFLY) - return String::from_deprecated_string(TRY(readlink("/proc/curproc/file"sv))); + return TRY(readlink("/proc/curproc/file"sv)); #elif defined(AK_OS_SOLARIS) - return String::from_deprecated_string(TRY(readlink("/proc/self/path/a.out"sv))); + return TRY(readlink("/proc/self/path/a.out"sv)); #elif defined(AK_OS_FREEBSD) int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; size_t len = sizeof(path); @@ -1862,7 +1862,7 @@ ErrorOr current_executable_path() return Error::from_string_view("current_executable_path unknown"sv); #endif path[sizeof(path) - 1] = '\0'; - return String::from_utf8({ path, strlen(path) }); + return DeprecatedString { path, strlen(path) }; } ErrorOr allocate(size_t count, size_t size) diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 716b66ecf60..c170adbbb13 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -279,7 +279,7 @@ ErrorOr resolve_executable_from_environment(StringView filename, int fla char** environment(); -ErrorOr current_executable_path(); +ErrorOr current_executable_path(); ErrorOr allocate(size_t count, size_t size); diff --git a/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp b/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp index 78f3b4a36c3..efa804192dc 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp @@ -18,7 +18,7 @@ namespace { ErrorOr application_directory() { auto current_executable_path = TRY(Core::System::current_executable_path()); - auto dirname = LexicalPath::dirname(current_executable_path.to_deprecated_string()); + auto dirname = LexicalPath::dirname(current_executable_path); return String::from_deprecated_string(dirname); } diff --git a/Userland/Utilities/pdf.cpp b/Userland/Utilities/pdf.cpp index 0593e0a89c0..c5b74e6829f 100644 --- a/Userland/Utilities/pdf.cpp +++ b/Userland/Utilities/pdf.cpp @@ -224,7 +224,7 @@ static PDF::PDFErrorOr pdf_main(Main::Arguments arguments) #if !defined(AK_OS_SERENITY) if (debugging_stats || !render_path.is_empty()) { // Get from Build/lagom/bin/pdf to Base/res/fonts. - auto source_root = LexicalPath(MUST(Core::System::current_executable_path()).to_deprecated_string()).parent().parent().parent().parent().string(); + auto source_root = LexicalPath(MUST(Core::System::current_executable_path())).parent().parent().parent().parent().string(); Core::ResourceImplementation::install(make(TRY(String::formatted("{}/Base/res", source_root)))); } #endif