summaryrefslogtreecommitdiff
path: root/Userland/Applications/ThemeEditor
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-04-28 17:17:37 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-29 20:06:39 +0200
commit91230ff28d88f1134dd9fa0d3766a4081b5b0b6f (patch)
tree081849ade33e07f07d78f67099c8408b960c1749 /Userland/Applications/ThemeEditor
parente05d5df6aa502a5461dbef1c456b334df6c7ff5a (diff)
downloadserenity-91230ff28d88f1134dd9fa0d3766a4081b5b0b6f.zip
ThemeEditor: Open the FilePicker at the location in the path input
The kernel panic no longer occurs, so we can do this now. :^)
Diffstat (limited to 'Userland/Applications/ThemeEditor')
-rw-r--r--Userland/Applications/ThemeEditor/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp
index a867794c8f..b54da37d10 100644
--- a/Userland/Applications/ThemeEditor/main.cpp
+++ b/Userland/Applications/ThemeEditor/main.cpp
@@ -256,11 +256,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
path_input.set_text(startup_preview_palette.path(Gfx::PathRole::TitleButtonIcons));
path_picker_button.on_click = [&](auto) {
- // FIXME: Open at the path_input location. Right now that's panicking the kernel though! :^(
auto role = path_combo_box.model()->index(path_combo_box.selected_index()).data(GUI::ModelRole::Custom).to_path_role();
bool open_folder = (role == Gfx::PathRole::TitleButtonIcons);
auto window_title = String::formatted(open_folder ? "Select {} folder" : "Select {} file", path_combo_box.text());
- auto result = GUI::FilePicker::get_open_filepath(window, window_title, "/res/icons", open_folder);
+ auto target_path = path_input.text();
+ if (Core::File::exists(target_path)) {
+ if (!Core::File::is_directory(target_path))
+ target_path = LexicalPath::dirname(target_path);
+ } else {
+ target_path = "/res/icons";
+ }
+ auto result = GUI::FilePicker::get_open_filepath(window, window_title, target_path, open_folder);
if (!result.has_value())
return;
path_input.set_text(*result);