summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-06-20 20:58:18 +0200
committerJosJuice <josjuice@gmail.com>2017-06-28 22:22:50 +0200
commit2ca5f1dec8e4d00159ff3b3b4be90e225f0621d2 (patch)
tree557608d0bb788dfc37b8c91b272844149f8e6dfd /Source
parent39ff203c1e60cae0f31fc881cd88fa68a203b79f (diff)
FilesystemPanel: Handle root correctly in BuildFilePathFromSelection
This was unnecessary in the past but is necessary for the next commit.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
index 3d7f594aec..1ecadba87e 100644
--- a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
+++ b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
@@ -401,15 +401,21 @@ void FilesystemPanel::ExtractDirectories(const std::string& full_path,
std::pair<wxString, const DiscIO::FileSystem&> FilesystemPanel::BuildFilePathFromSelection() const
{
- wxString file_path = m_tree_ctrl->GetItemText(m_tree_ctrl->GetSelection());
+ const wxTreeItemId root_node = m_tree_ctrl->GetRootItem();
+ wxTreeItemId node = m_tree_ctrl->GetSelection();
- const auto root_node = m_tree_ctrl->GetRootItem();
- auto node = m_tree_ctrl->GetItemParent(m_tree_ctrl->GetSelection());
+ wxString file_path;
- while (node != root_node)
+ if (node != root_node)
{
- file_path = m_tree_ctrl->GetItemText(node) + DIR_SEP_CHR + file_path;
+ file_path = m_tree_ctrl->GetItemText(node);
node = m_tree_ctrl->GetItemParent(node);
+
+ while (node != root_node)
+ {
+ file_path = m_tree_ctrl->GetItemText(node) + DIR_SEP_CHR + file_path;
+ node = m_tree_ctrl->GetItemParent(node);
+ }
}
if (m_has_partitions)