1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +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

@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <stdio.h>
int main(int argc, char** argv)
@ -38,6 +38,6 @@ int main(int argc, char** argv)
printf("usage: basename <path>\n");
return 1;
}
printf("%s\n", FileSystemPath(argv[1]).basename().characters());
printf("%s\n", LexicalPath(argv[1]).basename().characters());
return 0;
}

View file

@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
@ -112,7 +112,7 @@ bool copy_file(String src_path, String dst_path, struct stat src_stat, int src_f
StringBuilder builder;
builder.append(dst_path);
builder.append('/');
builder.append(FileSystemPath(src_path).basename());
builder.append(LexicalPath(src_path).basename());
dst_path = builder.to_string();
dst_fd = creat(dst_path.characters(), 0666);
if (dst_fd < 0) {

View file

@ -25,7 +25,7 @@
*/
#include <AK/ByteBuffer.h>
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
@ -164,7 +164,7 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
}
}
const auto basename = FileSystemPath(path).basename();
const auto basename = LexicalPath(path).basename();
for (const auto& pattern : du_option.excluded_patterns) {
if (basename.matches(pattern, CaseSensitivity::CaseSensitive))
return 0;

View file

@ -25,7 +25,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <sys/stat.h>
@ -52,18 +52,18 @@ int main(int argc, char** argv)
bool has_errors = false;
for (auto& directory : directories) {
FileSystemPath canonical_path(directory);
LexicalPath lexical_path(directory);
if (!create_parents) {
if (mkdir(canonical_path.string().characters(), mode) < 0) {
if (mkdir(lexical_path.string().characters(), mode) < 0) {
perror("mkdir");
has_errors = true;
}
continue;
}
StringBuilder path_builder;
if (canonical_path.is_absolute())
if (lexical_path.is_absolute())
path_builder.append("/");
for (auto& part : canonical_path.parts()) {
for (auto& part : lexical_path.parts()) {
path_builder.append(part);
auto path = path_builder.build();
struct stat st;

View file

@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/FileSystemPath.h>
#include <AK/LexicalPath.h>
#include <AK/String.h>
#include <LibCore/ArgsParser.h>
#include <stdio.h>
@ -56,7 +56,7 @@ int main(int argc, char** argv)
String combined_new_path;
if (rc == 0 && S_ISDIR(st.st_mode)) {
auto old_basename = FileSystemPath(old_path).basename();
auto old_basename = LexicalPath(old_path).basename();
combined_new_path = String::format("%s/%s", new_path, old_basename.characters());
new_path = combined_new_path.characters();
}

View file

@ -24,7 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/FileSystemPath.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/Vector.h>