From 2031baebce5f742f76aaafc08b75e38d62fc7ca6 Mon Sep 17 00:00:00 2001 From: Matteo Sozzi Date: Mon, 1 Feb 2021 22:05:14 +0100 Subject: [PATCH] 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. --- Userland/DevTools/HackStudio/HackStudioWidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 2effe95615..f1f5c73d74 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -209,6 +209,9 @@ Vector 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());