mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Everywhere: Unport Core::System::current_executable_path from new string
Storing paths in AK::String is never correct.
This commit is contained in:
parent
610fe28115
commit
d317309d89
9 changed files with 12 additions and 12 deletions
|
@ -25,7 +25,7 @@ ErrorOr<String> 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))
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<String> 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))
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<String> 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))
|
||||
|
|
|
@ -17,7 +17,7 @@ DeprecatedString s_serenity_resource_root;
|
|||
ErrorOr<String> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<String> 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))
|
||||
|
|
|
@ -1806,7 +1806,7 @@ char** environment()
|
|||
#endif
|
||||
}
|
||||
|
||||
ErrorOr<String> current_executable_path()
|
||||
ErrorOr<DeprecatedString> current_executable_path()
|
||||
{
|
||||
char path[4096] = {};
|
||||
#if defined(AK_OS_LINUX) || defined(AK_OS_ANDROID) || defined(AK_OS_SERENITY)
|
||||
|
@ -1827,9 +1827,9 @@ ErrorOr<String> 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<String> 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<Bytes> allocate(size_t count, size_t size)
|
||||
|
|
|
@ -279,7 +279,7 @@ ErrorOr<String> resolve_executable_from_environment(StringView filename, int fla
|
|||
|
||||
char** environment();
|
||||
|
||||
ErrorOr<String> current_executable_path();
|
||||
ErrorOr<DeprecatedString> current_executable_path();
|
||||
|
||||
ErrorOr<Bytes> allocate(size_t count, size_t size);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace {
|
|||
ErrorOr<String> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ static PDF::PDFErrorOr<int> 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<Core::ResourceImplementationFile>(TRY(String::formatted("{}/Base/res", source_root))));
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue