diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 8b9388773e..a75311da03 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -659,6 +659,7 @@ namespace vcpkg "{command_line}\n" "failed with the following results:"); DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder \"{path}\":"); + DECLARE_MESSAGE(CopyrightIsDir, (msg::path), "", "`{path}` being a directory is deprecated."); DECLARE_MESSAGE(CouldNotDeduceNugetIdAndVersion, (msg::path), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index 79df3b0828..b66cc45e67 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -77,6 +77,7 @@ "CmakeTargetsExcluded": "note: {count} additional targets are not displayed.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", "CompressFolderFailed": "Failed to compress folder \"{path}\":", + "CopyrightIsDir": "`{path}` being a directory is deprecated.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CreatedNuGetPackage": "Created nupkg: \"{path}\"", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", diff --git a/locales/messages.json b/locales/messages.json index a1b2a5c287..6ef870173c 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -140,6 +140,8 @@ "_CommandFailed.comment": "An example of {command_line} is vcpkg install zlib.", "CompressFolderFailed": "Failed to compress folder \"{path}\":", "_CompressFolderFailed.comment": "An example of {path} is /foo/bar.", + "CopyrightIsDir": "`{path}` being a directory is deprecated.", + "_CopyrightIsDir.comment": "An example of {path} is /foo/bar.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "_CouldNotDeduceNugetIdAndVersion.comment": "An example of {path} is /foo/bar.", "CreatedNuGetPackage": "Created nupkg: \"{path}\"", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index bd5c8da46b..cea447f51b 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -481,6 +481,7 @@ namespace vcpkg REGISTER_MESSAGE(CMakeTargetsUsageHeuristicMessage); REGISTER_MESSAGE(CMakeToolChainFile); REGISTER_MESSAGE(CommandFailed); + REGISTER_MESSAGE(CopyrightIsDir); REGISTER_MESSAGE(CompressFolderFailed); REGISTER_MESSAGE(CouldNotDeduceNugetIdAndVersion); REGISTER_MESSAGE(CreatedNuGetPackage); diff --git a/src/vcpkg/install.cpp b/src/vcpkg/install.cpp index 16d5b14780..baa50ee3ac 100644 --- a/src/vcpkg/install.cpp +++ b/src/vcpkg/install.cpp @@ -692,7 +692,7 @@ namespace vcpkg std::error_code ec; auto usage_file = installed.usage_file(bpgh.spec); - if (fs.exists(usage_file, IgnoreErrors{})) + if (fs.is_regular_file(usage_file)) { ret.usage_file = true; auto contents = fs.read_contents(usage_file, ec); diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index e74190036b..f264abde03 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -342,10 +342,14 @@ namespace vcpkg::PostBuildLint { const auto packages_dir = paths.packages() / spec.dir(); const auto copyright_file = packages_dir / "share" / spec.name() / "copyright"; - if (fs.exists(copyright_file, IgnoreErrors{})) + + switch (fs.status(copyright_file, IgnoreErrors{})) { - return LintStatus::SUCCESS; + case FileType::regular: return LintStatus::SUCCESS; break; + case FileType::directory: msg::println_warning(msgCopyrightIsDir, msg::path = "copyright"); break; + default: break; } + const auto current_buildtrees_dir = paths.build_dir(spec); const auto current_buildtrees_dir_src = current_buildtrees_dir / "src";