Browse Source

GMLPlayground: Use current file name in the 'Save as...' dialog

Previously it was always "Untitled".
Karol Kosek 2 năm trước cách đây
mục cha
commit
e7954f62b3
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      Userland/DevTools/GMLPlayground/MainWidget.cpp

+ 3 - 1
Userland/DevTools/GMLPlayground/MainWidget.cpp

@@ -9,6 +9,7 @@
  */
 
 #include "MainWidget.h"
+#include <AK/LexicalPath.h>
 #include <LibDesktop/Launcher.h>
 #include <LibFileSystemAccessClient/Client.h>
 #include <LibGUI/Application.h>
@@ -123,7 +124,8 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
     auto file_menu = TRY(window.try_add_menu("&File"_short_string));
 
     auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
-        auto response = FileSystemAccessClient::Client::the().save_file(&window, "Untitled", "gml");
+        LexicalPath initial_path(m_file_path.is_empty() ? "Untitled.gml" : m_file_path);
+        auto response = FileSystemAccessClient::Client::the().save_file(&window, initial_path.title(), initial_path.extension());
         if (response.is_error())
             return;