mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibFileSystem+Userland: Return ByteString from absolute_path()
This commit is contained in:
parent
fb644d08ac
commit
cdf17efb9a
7 changed files with 12 additions and 14 deletions
|
@ -35,8 +35,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
ByteString destination_dir = (sources.size() > 1 ? ByteString { destination } : LexicalPath::dirname(destination));
|
||||
|
||||
if (create_leading_dest_components) {
|
||||
String destination_dir_absolute = TRY(FileSystem::absolute_path(destination_dir));
|
||||
MUST(Core::Directory::create(destination_dir_absolute.to_byte_string(), Core::Directory::CreateDirectories::Yes));
|
||||
auto destination_dir_absolute = TRY(FileSystem::absolute_path(destination_dir));
|
||||
MUST(Core::Directory::create(destination_dir_absolute, Core::Directory::CreateDirectories::Yes));
|
||||
}
|
||||
|
||||
for (auto const& source : sources) {
|
||||
|
|
|
@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (target_directory.is_empty()) {
|
||||
if (!file_template.is_empty()) {
|
||||
auto resolved_path = LexicalPath(TRY(FileSystem::absolute_path(file_template)).to_byte_string());
|
||||
auto resolved_path = LexicalPath(TRY(FileSystem::absolute_path(file_template)));
|
||||
final_target_directory = TRY(String::from_utf8(resolved_path.dirname()));
|
||||
final_file_template = TRY(String::from_utf8(resolved_path.basename()));
|
||||
} else {
|
||||
|
|
|
@ -952,7 +952,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
pos_args.remove(0);
|
||||
}
|
||||
|
||||
HashMap<String, String> paths_to_unveil;
|
||||
HashMap<ByteString, String> paths_to_unveil;
|
||||
|
||||
for (auto const& input_filename : TRY(script.input_filenames())) {
|
||||
TRY(paths_to_unveil.try_set(TRY(FileSystem::absolute_path(input_filename)), edit_in_place ? "rwc"_string : "r"_string));
|
||||
|
|
|
@ -167,7 +167,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln("{}", filename);
|
||||
|
||||
if (extract) {
|
||||
ByteString absolute_path = TRY(FileSystem::absolute_path(filename)).to_byte_string();
|
||||
auto absolute_path = TRY(FileSystem::absolute_path(filename));
|
||||
auto parent_path = LexicalPath(absolute_path).parent();
|
||||
auto header_mode = TRY(header.mode());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue