浏览代码

FileManager: Canonicalize paths when opening them.

Andreas Kling 6 年之前
父节点
当前提交
7c06431ff7
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 3 1
      Applications/FileManager/DirectoryTableModel.cpp
  2. 1 1
      Applications/FileManager/DirectoryTableView.cpp

+ 3 - 1
Applications/FileManager/DirectoryTableModel.cpp

@@ -187,8 +187,10 @@ void DirectoryTableModel::update()
     did_update();
     did_update();
 }
 }
 
 
-void DirectoryTableModel::open(const String& path)
+void DirectoryTableModel::open(const String& a_path)
 {
 {
+    FileSystemPath canonical_path(a_path);
+    auto path = canonical_path.string();
     if (m_path == path)
     if (m_path == path)
         return;
         return;
     DIR* dirp = opendir(path.characters());
     DIR* dirp = opendir(path.characters());

+ 1 - 1
Applications/FileManager/DirectoryTableView.cpp

@@ -37,5 +37,5 @@ void DirectoryTableView::set_status_message(const String& message)
 
 
 void DirectoryTableView::open_parent_directory()
 void DirectoryTableView::open_parent_directory()
 {
 {
-    model().open("..");
+    model().open(String::format("%s/..", model().path().characters()));
 }
 }