Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline simple filesystem functions #1550

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ namespace vcpkg
}
};

bool is_symlink(FileType s);
bool is_regular_file(FileType s);
bool is_directory(FileType s);
bool exists(FileType s);
constexpr bool is_symlink(FileType s) noexcept { return s == FileType::symlink || s == FileType::junction; }
constexpr bool is_regular_file(FileType s) noexcept { return s == FileType::regular; }
constexpr bool is_directory(FileType s) noexcept { return s == FileType::directory; }
constexpr bool exists(FileType s) noexcept { return s != FileType::not_found && s != FileType::none; }

struct FilePointer
{
Expand Down
4 changes: 2 additions & 2 deletions include/vcpkg/commands.install.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ namespace vcpkg
Path m_listfile;

public:
const Path& destination() const;
const Path& listfile() const;
const Path& destination() const noexcept { return this->m_destination; }
const Path& listfile() const noexcept { return this->m_listfile; }
};

void install_package_and_write_listfile(const Filesystem& fs,
Expand Down
5 changes: 0 additions & 5 deletions src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1366,11 +1366,6 @@ namespace vcpkg

const char* to_printf_arg(const Path& p) noexcept { return p.m_str.c_str(); }

bool is_symlink(FileType s) { return s == FileType::symlink || s == FileType::junction; }
bool is_regular_file(FileType s) { return s == FileType::regular; }
bool is_directory(FileType s) { return s == FileType::directory; }
bool exists(FileType s) { return s != FileType::not_found && s != FileType::none; }

FilePointer::FilePointer(const Path& path) : m_fs(nullptr), m_path(path) { }
FilePointer::FilePointer() noexcept : m_fs(nullptr), m_path{} { }

Expand Down
4 changes: 0 additions & 4 deletions src/vcpkg/commands.install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ namespace vcpkg
return dirs;
}

const Path& InstallDir::destination() const { return this->m_destination; }

const Path& InstallDir::listfile() const { return this->m_listfile; }

void install_package_and_write_listfile(const Filesystem& fs,
const Path& source_dir,
const InstallDir& destination_dir)
Expand Down