1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

AK: Rename FileSystemPath -> LexicalPath

And move canonicalized_path() to a static method on LexicalPath.

This is to make it clear that FileSystemPath/canonicalized_path() only
perform *lexical* canonicalization.
This commit is contained in:
Sergey Bugaev 2020-05-26 14:52:44 +03:00 committed by Andreas Kling
parent f746bbda17
commit 602c3fdb3a
44 changed files with 174 additions and 181 deletions

View file

@ -27,7 +27,7 @@
#include "Editor.h"
#include "EditorWrapper.h"
#include <AK/ByteBuffer.h>
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibGUI/Application.h>
@ -137,7 +137,7 @@ static HashMap<String, String>& man_paths()
Core::DirIterator it("/usr/share/man/man2", Core::DirIterator::Flags::SkipDots);
while (it.has_next()) {
auto path = String::format("/usr/share/man/man2/%s", it.next_path().characters());
auto title = FileSystemPath(path).title();
auto title = LexicalPath(path).title();
paths.set(title, path);
}
}

View file

@ -25,7 +25,7 @@
*/
#include "Project.h"
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
#include <AK/StringBuilder.h>
#include <LibCore/DirIterator.h>
@ -169,7 +169,7 @@ private:
Project::Project(const String& path, Vector<String>&& filenames)
: m_path(path)
{
m_name = FileSystemPath(m_path).basename();
m_name = LexicalPath(m_path).basename();
m_file_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"));
m_cplusplus_icon = GUI::Icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"));
@ -283,7 +283,7 @@ bool Project::save()
ProjectFile* Project::get_file(const String& filename)
{
for (auto& file : m_files) {
if (FileSystemPath(file.name()).string() == FileSystemPath(filename).string())
if (LexicalPath(file.name()).string() == LexicalPath(filename).string())
return &file;
}
return nullptr;
@ -307,7 +307,7 @@ void Project::rebuild_tree()
root->type = ProjectTreeNode::Type::Project;
for (auto& file : m_files) {
FileSystemPath path(file.name());
LexicalPath path(file.name());
ProjectTreeNode* current = root.ptr();
StringBuilder partial_path;

View file

@ -242,7 +242,7 @@ int main(int argc, char** argv)
String message;
if (files.size() == 1) {
message = String::format("Really remove %s from the project?", FileSystemPath(files[0]).basename().characters());
message = String::format("Really remove %s from the project?", LexicalPath(files[0]).basename().characters());
} else {
message = String::format("Really remove %d files from the project?", files.size());
}
@ -711,8 +711,8 @@ void run(TerminalWrapper& wrapper)
void open_project(String filename)
{
FileSystemPath path(filename);
if (chdir(path.dirname().characters()) < 0) {
LexicalPath lexical_path(filename);
if (chdir(lexical_path.dirname().characters()) < 0) {
perror("chdir");
exit(1);
}