Explorar o código

HackStudio: do not open empty directories as file

When _double clicking_ or _right click > Open_ in the tree view, the
selected directory, if empty, was open in the editor section as file.
Matteo Sozzi %!s(int64=4) %!d(string=hai) anos
pai
achega
2031baebce
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      Userland/DevTools/HackStudio/HackStudioWidget.cpp

+ 3 - 0
Userland/DevTools/HackStudio/HackStudioWidget.cpp

@@ -209,6 +209,9 @@ Vector<String> HackStudioWidget::selected_file_names() const
 
 void HackStudioWidget::open_file(const String& filename)
 {
+    if (Core::File::is_directory(filename))
+        return;
+
     if (!currently_open_file().is_empty()) {
         // Since the file is previously open, it should always be in m_open_files.
         ASSERT(m_open_files.find(currently_open_file()) != m_open_files.end());