summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/HackStudioWidget.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@krkk.ct8.pl>2021-08-12 22:31:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-22 23:41:53 +0200
commit90396f5b08f48ed9e0c0d47492dc7a2a1d66bb9a (patch)
tree66de6ce906996f70dc1fbb21f1e22a61def58a10 /Userland/DevTools/HackStudio/HackStudioWidget.cpp
parent9bef96748d6d8534127a0270969bc10d6b37e5f3 (diff)
downloadserenity-90396f5b08f48ed9e0c0d47492dc7a2a1d66bb9a.zip
HackStudio: Convert selected path to a relative path on 'Save as...'
This makes the editor title a bit more consistent with the other files and removes duplicating the file name in the file history when reopening that file.
Diffstat (limited to 'Userland/DevTools/HackStudio/HackStudioWidget.cpp')
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 4ded82222e..c53a95f920 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -652,12 +652,13 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
return;
}
- current_editor_wrapper().set_filename(save_path.value());
+ String const relative_file_path = LexicalPath::relative_path(save_path.value(), m_project->root_path());
+ current_editor_wrapper().set_filename(relative_file_path);
current_editor_wrapper().save();
- auto new_project_file = m_project->get_file(save_path.value());
- m_open_files.set(save_path.value(), *new_project_file);
- m_open_files_vector.append(save_path.value());
+ auto new_project_file = m_project->get_file(relative_file_path);
+ m_open_files.set(relative_file_path, *new_project_file);
+ m_open_files_vector.append(relative_file_path);
update_window_title();
});