mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
GMLPlayground: Set file path when reading file
We weren't setting the path on the 'Open' action, which meant that a startup file name was always visible in the title bar (unless we save a file to a different path, or pick a file from the 'recent files' list). By setting it to update the stored file path in the load_file() function, it'll be guaranteed the file name will always be set. This also will add the startup opened file to the recently opened files list.
This commit is contained in:
parent
259f4ffce1
commit
3c13faff57
1 changed files with 2 additions and 4 deletions
|
@ -136,6 +136,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
editor->set_text(buffer_or_error.release_value());
|
||||
editor->set_focus(true);
|
||||
file_path = file.filename().to_deprecated_string();
|
||||
update_title();
|
||||
|
||||
GUI::Application::the()->set_most_recently_open_file(file.filename());
|
||||
|
@ -209,7 +210,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, action.text());
|
||||
if (response.is_error())
|
||||
return;
|
||||
file_path = response.value().filename().to_deprecated_string();
|
||||
load_file(response.release_value());
|
||||
}));
|
||||
|
||||
|
@ -337,9 +337,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
update_title();
|
||||
} else {
|
||||
auto file = TRY(FileSystemAccessClient::Client::the().request_file_read_only_approved(window, path));
|
||||
file_path = path;
|
||||
editor->set_text(TRY(file.release_stream()->read_until_eof()));
|
||||
update_title();
|
||||
load_file(move(file));
|
||||
}
|
||||
|
||||
return app->exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue