UserspaceEmulator: Prefer FileSystem over DeprecatedFile
This commit is contained in:
parent
eabadf9e02
commit
00bd443d1c
Notes:
sideshowbarker
2024-07-16 21:51:02 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/00bd443d1c Pull-request: https://github.com/SerenityOS/serenity/pull/19135 Issue: https://github.com/SerenityOS/serenity/issues/18804 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/timschumi
1 changed files with 6 additions and 6 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <serenity.h>
|
||||
|
@ -43,15 +44,14 @@ int main(int argc, char** argv, char** env)
|
|||
if (dump_profile && profile_instruction_interval == 0)
|
||||
profile_instruction_interval = 128;
|
||||
|
||||
DeprecatedString executable_path;
|
||||
if (arguments[0].contains("/"sv))
|
||||
executable_path = Core::DeprecatedFile::real_path_for(arguments[0]);
|
||||
else
|
||||
executable_path = Core::DeprecatedFile::resolve_executable_from_environment(arguments[0]).value_or({});
|
||||
if (executable_path.is_empty()) {
|
||||
auto executable_path_or_error = arguments[0].contains('/')
|
||||
? FileSystem::real_path(arguments[0])
|
||||
: FileSystem::resolve_executable_from_environment(arguments[0]);
|
||||
if (executable_path_or_error.is_error()) {
|
||||
reportln("Cannot find executable for '{}'."sv, arguments[0]);
|
||||
return 1;
|
||||
}
|
||||
auto executable_path = executable_path_or_error.release_value().to_deprecated_string();
|
||||
|
||||
if (dump_profile && profile_dump_path.is_empty())
|
||||
profile_dump_path = DeprecatedString::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid());
|
||||
|
|
Loading…
Add table
Reference in a new issue