1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

Added --exclude-compressed flag feature that skips compression of precompressed files

This commit is contained in:
Shashank Tavildar
2019-10-25 15:49:11 -07:00
parent 6d5e0f1c9f
commit 48f856640e
5 changed files with 52 additions and 2 deletions

View File

@ -326,6 +326,27 @@ int UTIL_prepareFileList(const char *dirName, char** bufStart, size_t* pos, char
#endif /* #ifdef _WIN32 */
/* Check if the file is precompressed (.zst, .lz4, .gz, .xz).
YES => Skip the file (return 0)
NO => return 1
*/
int UTIL_isPrecompressedFile(const char *inputName)
{
return compareExtensions(inputName,compressedFileExtensions);
}
int compareExtensions(const char* infilename, const char extensionList[4][10])
{
int i=0;
//char* ext = strchr(infilename, '.');
for(i=0;i<4;i++)
{
char* ext = strstr(infilename,extensionList[i]);
if(ext)
return 0;
}
return 1;
}
/*
* UTIL_createFileList - takes a list of files and directories (params: inputNames, inputNamesNb), scans directories,
* and returns a new list of files (params: return value, allocatedBuffer, allocatedNamesNb).