Support parsing KF files in niftest

Mention BA2 support in help messages
ini_importer_tests
Alexei Kotov 11 months ago
parent cdf2459ed8
commit 29a40c212f

@ -34,7 +34,7 @@ bool hasExtension(const std::filesystem::path& filename, const std::string& exte
/// See if the file has the "nif" extension. /// See if the file has the "nif" extension.
bool isNIF(const std::filesystem::path& filename) bool isNIF(const std::filesystem::path& filename)
{ {
return hasExtension(filename, ".nif"); return hasExtension(filename, ".nif") || hasExtension(filename, ".kf");
} }
/// See if the file has the "bsa" extension. /// See if the file has the "bsa" extension.
bool isBSA(const std::filesystem::path& filename) bool isBSA(const std::filesystem::path& filename)
@ -76,7 +76,10 @@ void readNIF(
const std::string pathStr = Files::pathToUnicodeString(path); const std::string pathStr = Files::pathToUnicodeString(path);
if (!quiet) if (!quiet)
{ {
std::cout << "Reading NIF file '" << pathStr << "'"; if (hasExtension(path, ".kf"))
std::cout << "Reading KF file '" << pathStr << "'";
else
std::cout << "Reading NIF file '" << pathStr << "'";
if (!source.empty()) if (!source.empty())
std::cout << " from '" << Files::pathToUnicodeString(isBSA(source) ? source.filename() : source) << "'"; std::cout << " from '" << Files::pathToUnicodeString(isBSA(source) ? source.filename() : source) << "'";
std::cout << std::endl; std::cout << std::endl;
@ -139,10 +142,10 @@ void readVFS(std::unique_ptr<VFS::Archive>&& archive, const std::filesystem::pat
bool parseOptions(int argc, char** argv, Files::PathContainer& files, Files::PathContainer& archives, bool parseOptions(int argc, char** argv, Files::PathContainer& files, Files::PathContainer& archives,
bool& writeDebugLog, bool& quiet) bool& writeDebugLog, bool& quiet)
{ {
bpo::options_description desc(R"(Ensure that OpenMW can use the provided NIF and BSA files bpo::options_description desc(R"(Ensure that OpenMW can use the provided NIF, KF and BSA/BA2 files
Usages: Usages:
niftest <nif files, BSA files, or directories> niftest <nif files, kf files, BSA/BA2 files, or directories>
Scan the file or directories for NIF errors. Scan the file or directories for NIF errors.
Allowed options)"); Allowed options)");
@ -241,7 +244,8 @@ int main(int argc, char** argv)
} }
else else
{ {
std::cerr << "Error: '" << pathStr << "' is not a NIF file, BSA/BA2 archive, or directory" << std::endl; std::cerr << "Error: '" << pathStr << "' is not a NIF/KF file, BSA/BA2 archive, or directory"
<< std::endl;
} }
} }
catch (std::exception& e) catch (std::exception& e)

Loading…
Cancel
Save