Move ArchiveType into it's own file
This commit is contained in:
@@ -13,7 +13,6 @@ namespace OpenVulkano
|
||||
namespace
|
||||
{
|
||||
constexpr int TYPE_MAP[] = { ARCHIVE_FORMAT_TAR, ARCHIVE_FORMAT_CPIO, ARCHIVE_FORMAT_ISO9660, ARCHIVE_FORMAT_ZIP, ARCHIVE_FORMAT_XAR, ARCHIVE_FORMAT_7ZIP, ARCHIVE_FORMAT_WARC, ARCHIVE_FORMAT_SHAR };
|
||||
constexpr std::string_view TYPE_NAMES[] = { ".tar", ".cpio", ".iso", ".zip", ".xar", ".7z", ".warc", ".shar" };
|
||||
|
||||
constexpr int COMP_MAP[] = { ARCHIVE_FILTER_COMPRESS, ARCHIVE_FILTER_NONE, ARCHIVE_FILTER_GZIP, ARCHIVE_FILTER_BZIP2, ARCHIVE_FILTER_XZ, ARCHIVE_FILTER_LZ4, ARCHIVE_FILTER_ZSTD };
|
||||
constexpr std::string_view COMP_NAMES[] = { ".Z", "", ".gz", ".bz2", ".xz", ".lz", ".zst" };
|
||||
@@ -23,7 +22,7 @@ namespace OpenVulkano
|
||||
|
||||
std::string ArchiveConfiguration::GetFileExtension() const
|
||||
{
|
||||
const std::string_view& tName = TYPE_NAMES[static_cast<int>(type)];
|
||||
const std::string_view tName = type.GetExtension();
|
||||
if (type == ArchiveType::TAR)
|
||||
{
|
||||
const std::string_view& cName = COMP_NAMES[static_cast<int>(compression)];
|
||||
@@ -39,20 +38,12 @@ namespace OpenVulkano
|
||||
{
|
||||
std::string_view fName = fileName;
|
||||
ArchiveConfiguration ac;
|
||||
int tId = 0;
|
||||
for(const std::string_view& tName : TYPE_NAMES)
|
||||
if (auto type = ArchiveType::FromExtension(fName))
|
||||
{
|
||||
if (tId > 0)
|
||||
{
|
||||
if (Utils::EndsWith(fName, tName))
|
||||
{
|
||||
ac.type = static_cast<ArchiveType>(tId);
|
||||
return ac;
|
||||
}
|
||||
}
|
||||
tId++;
|
||||
ac.type = *type;
|
||||
return ac;
|
||||
}
|
||||
tId = 0;
|
||||
int tId = 0;
|
||||
for(const std::string_view& tsName : TAR_SORTS)
|
||||
{
|
||||
if (Utils::EndsWith(fName, tsName))
|
||||
|
||||
Reference in New Issue
Block a user