mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
mktemp: Make sure to use target directory option argument
Previously, we ignored the -p argument if it was specified. This would resort in a crash because final_target_directory wasn't given a value. This snapshot does away with giving this variable an Optional<> and just has the -p argument be its default value.
This commit is contained in:
parent
f4b345258d
commit
22ea2f638a
Notes:
sideshowbarker
2024-07-17 08:55:54 +09:00
Author: https://github.com/kemzeb Commit: https://github.com/SerenityOS/serenity/commit/22ea2f638a Pull-request: https://github.com/SerenityOS/serenity/pull/22783 Issue: https://github.com/SerenityOS/serenity/issues/22773 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/kleinesfilmroellchen ✅
1 changed files with 2 additions and 2 deletions
|
@ -72,7 +72,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
args_parser.parse(arguments);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
Optional<ByteString> final_file_template;
|
Optional<ByteString> final_file_template;
|
||||||
Optional<ByteString> final_target_directory;
|
ByteString final_target_directory = target_directory;
|
||||||
|
|
||||||
if (target_directory.is_empty()) {
|
if (target_directory.is_empty()) {
|
||||||
if (!file_template.is_empty()) {
|
if (!file_template.is_empty()) {
|
||||||
|
@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto target_path = LexicalPath::join(final_target_directory.value(), final_file_template.value()).string();
|
auto target_path = LexicalPath::join(final_target_directory, final_file_template.value()).string();
|
||||||
|
|
||||||
auto final_path = TRY(make_temp(target_path, create_directory, dry_run));
|
auto final_path = TRY(make_temp(target_path, create_directory, dry_run));
|
||||||
if (!final_path.has_value()) {
|
if (!final_path.has_value()) {
|
||||||
|
|
Loading…
Reference in a new issue