AK: Add a canonicalized_path() convenience function.

This is the same as calling FileSystemPath(foo).string(). The majority of
clients only care about canonicalizing a path, so let's have an easy way
to express that.
This commit is contained in:
Andreas Kling 2019-07-15 06:49:28 +02:00
parent cd497accbe
commit 954a0b8efe
Notes: sideshowbarker 2024-07-19 13:15:54 +09:00
7 changed files with 33 additions and 25 deletions

View file

@ -92,7 +92,7 @@ struct GFileSystemModel::Node {
}
builder.append('/');
builder.append(name);
return FileSystemPath(builder.to_string()).string();
return canonicalized_path(builder.to_string());
}
};
@ -130,7 +130,7 @@ String GFileSystemModel::path(const GModelIndex& index) const
}
GFileSystemModel::GFileSystemModel(const StringView& root_path, Mode mode)
: m_root_path(FileSystemPath(root_path).string())
: m_root_path(canonicalized_path(root_path))
, m_mode(mode)
{
m_open_folder_icon = GIcon::default_icon("filetype-folder-open");