Limo
A simple mod manager
Loading...
Searching...
No Matches
pathutils.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <filesystem>
9#include <functional>
10#include <optional>
11
12
16namespace path_utils
17{
25std::optional<std::filesystem::path> pathExists(const std::filesystem::path& path_to_check,
26 const std::filesystem::path& base_path,
27 bool case_insensitive = true);
28
34std::string toLowerCase(const std::filesystem::path& path);
41void moveFilesToDirectory(const std::filesystem::path& source,
42 const std::filesystem::path& destination,
43 bool move = true);
48std::string normalizePath(const std::string& path);
56std::string getRelativePath(std::filesystem::path target, std::filesystem::path source);
63bool directoryIsEmpty(const std::filesystem::path& directory, std::vector<std::string> ignored_files={});
69int getPathLength(const std::filesystem::path& path);
76std::pair<std::filesystem::path, std::filesystem::path> removePathComponents(
77 const std::filesystem::path& path,
78 int depth);
87void renameFiles(const std::filesystem::path& destination,
88 const std::filesystem::path& source,
89 std::function<unsigned char(unsigned char)> converter);
97void moveFilesWithDepth(const std::filesystem::path& source,
98 const std::filesystem::path& destination,
99 int depth);
100
107void copyOrMoveFiles(const std::filesystem::path& source,
108 const std::filesystem::path& destination,
109 bool move);
116bool exists(const std::filesystem::path& path);
117}
char path[256]
Path to which to extract the file.
Definition lspakfilelistentry.h:1
Contains utility functions for dealing with std::filesystem::path objects.
Definition pathutils.cpp:11
bool exists(const std::filesystem::path &path)
Checks whether the given path exists. This differs from std::filesystem::exists in that true is retur...
Definition pathutils.cpp:205
std::string normalizePath(const std::string &path)
Replaces all double backslash path separators with a forward slash.
Definition pathutils.cpp:86