mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
[pzstd] Check if input is a directory
This commit is contained in:
@@ -102,6 +102,14 @@ static FILE *openInputFile(const std::string &inputFile,
|
|||||||
SET_BINARY_MODE(stdin);
|
SET_BINARY_MODE(stdin);
|
||||||
return stdin;
|
return stdin;
|
||||||
}
|
}
|
||||||
|
// Check if input file is a directory
|
||||||
|
{
|
||||||
|
std::error_code ec;
|
||||||
|
if (is_directory(inputFile, ec)) {
|
||||||
|
errorHolder.setError("Output file is a directory -- ignored");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
auto inputFd = std::fopen(inputFile.c_str(), "rb");
|
auto inputFd = std::fopen(inputFile.c_str(), "rb");
|
||||||
if (!errorHolder.check(inputFd != nullptr, "Failed to open input file")) {
|
if (!errorHolder.check(inputFd != nullptr, "Failed to open input file")) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Reference in New Issue
Block a user