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

ignore .DS_Store files at various locations #344

Merged
merged 2 commits into from
Feb 12, 2022
Merged
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
4 changes: 4 additions & 0 deletions src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ namespace vcpkg::Build
size_t port_file_count = 0;
for (auto& port_file : fs.get_regular_files_recursive(port_dir, VCPKG_LINE_INFO))
{
if (port_file.filename() == ".DS_Store")
{
continue;
}
abi_tag_entries.emplace_back(
port_file.filename(),
vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, fs, port_file, Hash::Algorithm::Sha256));
Expand Down
4 changes: 3 additions & 1 deletion src/vcpkg/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace vcpkg::Install
fs.exists(source_dir, IgnoreErrors{}),
Strings::concat("Source directory ", source_dir, "does not exist"));
auto files = fs.get_files_recursive(source_dir, VCPKG_LINE_INFO);
Util::erase_remove_if(files, [](Path& path) { return path.filename() == ".DS_Store"; });
install_files_and_write_listfile(fs, source_dir, files, destination_dir);
}
void install_files_and_write_listfile(Filesystem& fs,
Expand Down Expand Up @@ -177,7 +178,8 @@ namespace vcpkg::Install

static SortedVector<std::string> build_list_of_package_files(const Filesystem& fs, const Path& package_dir)
{
const std::vector<Path> package_file_paths = fs.get_files_recursive(package_dir, IgnoreErrors{});
std::vector<Path> package_file_paths = fs.get_files_recursive(package_dir, IgnoreErrors{});
Util::erase_remove_if(package_file_paths, [](Path& path) { return path.filename() == ".DS_Store"; });
const size_t package_remove_char_count = package_dir.native().size() + 1; // +1 for the slash
auto package_files = Util::fmap(package_file_paths, [package_remove_char_count](const Path& target) {
return std::string(target.generic_u8string(), package_remove_char_count);
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/postbuildlint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ namespace vcpkg::PostBuildLint
std::vector<Path> misplaced_files = fs.get_regular_files_non_recursive(dir, IgnoreErrors{});
Util::erase_remove_if(misplaced_files, [](const Path& target) {
const auto filename = target.filename();
return filename == "CONTROL" || filename == "BUILD_INFO";
return filename == "CONTROL" || filename == "BUILD_INFO" || filename == ".DS_Store";
});

if (!misplaced_files.empty())
Expand Down
9 changes: 8 additions & 1 deletion src/vcpkg/vcpkgpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,10 @@ namespace vcpkg
{
for (auto&& path : fs.get_regular_files_non_recursive(triplets_dir, VCPKG_LINE_INFO))
{
output.emplace_back(TripletFile(path.stem(), triplets_dir));
if (Strings::case_insensitive_ascii_equals(path.extension(), ".cmake"))
{
output.emplace_back(TripletFile(path.stem(), triplets_dir));
}
}
}

Expand All @@ -747,6 +750,10 @@ namespace vcpkg
auto files = fs.get_regular_files_non_recursive(this->scripts / "cmake", VCPKG_LINE_INFO);
for (auto&& file : files)
{
if (file.filename() == ".DS_Store")
{
continue;
}
helpers.emplace(file.stem().to_string(),
Hash::get_file_hash(VCPKG_LINE_INFO, fs, file, Hash::Algorithm::Sha256));
}
Expand Down