mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-05-10 06:24:57 +00:00
Unlinker: Move zone file into zone_source folder
This commit is contained in:
parent
d220aa8fde
commit
1d609cc2d2
@ -16,19 +16,22 @@ const CommandLineOption* optionHelp = CommandLineOption::Builder::Create()
|
|||||||
const CommandLineOption* optionMinimalZoneFile = CommandLineOption::Builder::Create()
|
const CommandLineOption* optionMinimalZoneFile = CommandLineOption::Builder::Create()
|
||||||
.WithShortName("min")
|
.WithShortName("min")
|
||||||
.WithLongName("minimal-zone")
|
.WithLongName("minimal-zone")
|
||||||
.WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.")
|
.WithDescription(
|
||||||
|
"Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
const CommandLineOption* optionList = CommandLineOption::Builder::Create()
|
const CommandLineOption* optionList = CommandLineOption::Builder::Create()
|
||||||
.WithShortName("l")
|
.WithShortName("l")
|
||||||
.WithLongName("list")
|
.WithLongName("list")
|
||||||
.WithDescription("Lists the contents of a zone instead of writing them to the disk.")
|
.WithDescription(
|
||||||
|
"Lists the contents of a zone instead of writing them to the disk.")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
const CommandLineOption* optionOutputFolder = CommandLineOption::Builder::Create()
|
const CommandLineOption* optionOutputFolder = CommandLineOption::Builder::Create()
|
||||||
.WithShortName("o")
|
.WithShortName("o")
|
||||||
.WithLongName("output-folder")
|
.WithLongName("output-folder")
|
||||||
.WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to ./%zoneName%")
|
.WithDescription(
|
||||||
|
"Specifies the output folder containing the contents of the unlinked zones. Defaults to ./%zoneName%")
|
||||||
.WithParameter("outputFolderPath")
|
.WithParameter("outputFolderPath")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@ -64,13 +67,13 @@ int main(const int argc, const char** argv)
|
|||||||
{
|
{
|
||||||
ArgumentParser argumentParser(commandLineOptions, _countof(commandLineOptions));
|
ArgumentParser argumentParser(commandLineOptions, _countof(commandLineOptions));
|
||||||
|
|
||||||
if(!argumentParser.ParseArguments(argc, argv))
|
if (!argumentParser.ParseArguments(argc, argv))
|
||||||
{
|
{
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argumentParser.IsOptionSpecified(optionHelp))
|
if (argumentParser.IsOptionSpecified(optionHelp))
|
||||||
{
|
{
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return 0;
|
return 0;
|
||||||
@ -78,7 +81,7 @@ int main(const int argc, const char** argv)
|
|||||||
|
|
||||||
const std::vector<std::string> arguments = argumentParser.GetArguments();
|
const std::vector<std::string> arguments = argumentParser.GetArguments();
|
||||||
const size_t argCount = arguments.size();
|
const size_t argCount = arguments.size();
|
||||||
if(argCount <= 1)
|
if (argCount <= 1)
|
||||||
{
|
{
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
return 1;
|
return 1;
|
||||||
@ -86,12 +89,12 @@ int main(const int argc, const char** argv)
|
|||||||
|
|
||||||
std::vector<Zone*> loadedZones;
|
std::vector<Zone*> loadedZones;
|
||||||
|
|
||||||
for(unsigned argIndex = 1; argIndex < argCount; argIndex++)
|
for (unsigned argIndex = 1; argIndex < argCount; argIndex++)
|
||||||
{
|
{
|
||||||
const std::string& zonePath = arguments[argIndex];
|
const std::string& zonePath = arguments[argIndex];
|
||||||
|
|
||||||
Zone* zone = ZoneLoading::LoadZone(zonePath);
|
Zone* zone = ZoneLoading::LoadZone(zonePath);
|
||||||
if(zone == nullptr)
|
if (zone == nullptr)
|
||||||
{
|
{
|
||||||
printf("Failed to load zone '%s'.\n", zonePath.c_str());
|
printf("Failed to load zone '%s'.\n", zonePath.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
@ -100,9 +103,9 @@ int main(const int argc, const char** argv)
|
|||||||
loadedZones.push_back(zone);
|
loadedZones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argumentParser.IsOptionSpecified(optionList))
|
if (argumentParser.IsOptionSpecified(optionList))
|
||||||
{
|
{
|
||||||
for(auto zone : loadedZones)
|
for (auto zone : loadedZones)
|
||||||
{
|
{
|
||||||
ContentPrinter printer(zone);
|
ContentPrinter printer(zone);
|
||||||
printer.PrintContent();
|
printer.PrintContent();
|
||||||
@ -127,9 +130,11 @@ int main(const int argc, const char** argv)
|
|||||||
|
|
||||||
FileAPI::DirectoryCreate(outputFolderPath);
|
FileAPI::DirectoryCreate(outputFolderPath);
|
||||||
|
|
||||||
FileAPI::File zoneDefinitionFile = FileAPI::Open(utils::Path::Combine(outputFolderPath, zone->m_name + ".zone"), FileAPI::Mode::MODE_WRITE);
|
FileAPI::File zoneDefinitionFile = FileAPI::Open(
|
||||||
|
utils::Path::Combine(utils::Path::Combine(outputFolderPath, "zone_source"), zone->m_name + ".zone"),
|
||||||
|
FileAPI::Mode::MODE_WRITE);
|
||||||
|
|
||||||
if(zoneDefinitionFile.IsOpen())
|
if (zoneDefinitionFile.IsOpen())
|
||||||
{
|
{
|
||||||
ZoneLoading::WriteZoneDefinition(zone, &zoneDefinitionFile, minimalisticZoneDefinition);
|
ZoneLoading::WriteZoneDefinition(zone, &zoneDefinitionFile, minimalisticZoneDefinition);
|
||||||
ZoneLoading::DumpZone(zone, outputFolderPath);
|
ZoneLoading::DumpZone(zone, outputFolderPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user