mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-11 12:19:07 +00:00
Fixed extraction issues with root windows paths
This commit is contained in:
parent
69b5c4513f
commit
3941580275
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ struct ToolPassInfo
|
|||||||
{
|
{
|
||||||
HECL::SystemString pname;
|
HECL::SystemString pname;
|
||||||
HECL::SystemString cwd;
|
HECL::SystemString cwd;
|
||||||
std::vector<HECL::SystemString> args;
|
std::list<HECL::SystemString> args;
|
||||||
HECL::SystemString output;
|
HECL::SystemString output;
|
||||||
HECL::Database::Project* project = NULL;
|
HECL::Database::Project* project = NULL;
|
||||||
unsigned verbosityLevel = 0;
|
unsigned verbosityLevel = 0;
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
if (!info.project)
|
if (!info.project)
|
||||||
{
|
{
|
||||||
/* Get name from input file and init project there */
|
/* Get name from input file and init project there */
|
||||||
HECL::SystemString baseFile = info.args[0];
|
HECL::SystemString baseFile = info.args.front();
|
||||||
size_t slashPos = baseFile.rfind(_S('/'));
|
size_t slashPos = baseFile.rfind(_S('/'));
|
||||||
if (slashPos == HECL::SystemString::npos)
|
if (slashPos == HECL::SystemString::npos)
|
||||||
slashPos = baseFile.rfind(_S('\\'));
|
slashPos = baseFile.rfind(_S('\\'));
|
||||||
@ -50,7 +50,7 @@ public:
|
|||||||
LogModule.report(LogVisor::FatalError, "hecl extract must be ran within a project directory");
|
LogModule.report(LogVisor::FatalError, "hecl extract must be ran within a project directory");
|
||||||
|
|
||||||
size_t ErrorRef = LogVisor::ErrorCount;
|
size_t ErrorRef = LogVisor::ErrorCount;
|
||||||
HECL::SystemString rootDir = info.cwd + _S('/') + baseFile;
|
HECL::SystemString rootDir = info.cwd + baseFile;
|
||||||
HECL::ProjectRootPath newProjRoot(rootDir);
|
HECL::ProjectRootPath newProjRoot(rootDir);
|
||||||
newProjRoot.makeDir();
|
newProjRoot.makeDir();
|
||||||
m_fallbackProj.reset(new HECL::Database::Project(newProjRoot));
|
m_fallbackProj.reset(new HECL::Database::Project(newProjRoot));
|
||||||
@ -62,11 +62,12 @@ public:
|
|||||||
else
|
else
|
||||||
m_useProj = info.project;
|
m_useProj = info.project;
|
||||||
|
|
||||||
m_einfo.srcpath = m_info.args[0];
|
m_einfo.srcpath = m_info.args.front();
|
||||||
m_einfo.extractArgs.reserve(info.args.size() - 1);
|
m_einfo.extractArgs.reserve(info.args.size() - 1);
|
||||||
m_einfo.force = info.force;
|
m_einfo.force = info.force;
|
||||||
for (std::vector<HECL::SystemString>::const_iterator it=info.args.begin() + 1;
|
std::list<HECL::SystemString>::const_iterator it=info.args.begin();
|
||||||
it != info.args.end();
|
++it;
|
||||||
|
for (;it != info.args.end();
|
||||||
++it)
|
++it)
|
||||||
m_einfo.extractArgs.push_back(*it);
|
m_einfo.extractArgs.push_back(*it);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
ShowHelp(m_info.args[0]);
|
ShowHelp(m_info.args.front());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
HECL::Sstat theStat;
|
HECL::Sstat theStat;
|
||||||
const HECL::SystemString* dir;
|
const HECL::SystemString* dir;
|
||||||
if (info.args.size())
|
if (info.args.size())
|
||||||
dir = &info.args[0];
|
dir = &info.args.front();
|
||||||
else
|
else
|
||||||
dir = &info.cwd;
|
dir = &info.cwd;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
"hecl spec must be ran within a project directory");
|
"hecl spec must be ran within a project directory");
|
||||||
|
|
||||||
const auto& specs = info.project->getDataSpecs();
|
const auto& specs = info.project->getDataSpecs();
|
||||||
HECL::SystemString firstArg = info.args[0];
|
HECL::SystemString firstArg = info.args.front();
|
||||||
HECL::ToLower(firstArg);
|
HECL::ToLower(firstArg);
|
||||||
|
|
||||||
static const HECL::SystemString enable(_S("enable"));
|
static const HECL::SystemString enable(_S("enable"));
|
||||||
@ -40,8 +40,9 @@ public:
|
|||||||
if (info.args.size() < 2)
|
if (info.args.size() < 2)
|
||||||
LogModule.report(LogVisor::FatalError, "Speclist argument required");
|
LogModule.report(LogVisor::FatalError, "Speclist argument required");
|
||||||
|
|
||||||
for (auto it = info.args.begin()+1;
|
auto it = info.args.begin();
|
||||||
it != info.args.end();
|
++it;
|
||||||
|
for (;it != info.args.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -126,8 +127,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<HECL::SystemString> opSpecs;
|
std::vector<HECL::SystemString> opSpecs;
|
||||||
for (auto it = m_info.args.begin()+1;
|
auto it = m_info.args.begin();
|
||||||
it != m_info.args.end();
|
++it;
|
||||||
|
for (;it != m_info.args.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
HECL::SystemString itName = *it;
|
HECL::SystemString itName = *it;
|
||||||
|
@ -138,7 +138,15 @@ int main(int argc, const char** argv)
|
|||||||
info.pname = argv[0];
|
info.pname = argv[0];
|
||||||
HECL::SystemChar cwdbuf[1024];
|
HECL::SystemChar cwdbuf[1024];
|
||||||
if (HECL::Getcwd(cwdbuf, 1024))
|
if (HECL::Getcwd(cwdbuf, 1024))
|
||||||
|
{
|
||||||
info.cwd = cwdbuf;
|
info.cwd = cwdbuf;
|
||||||
|
if (info.cwd.size() && info.cwd.back() != _S('/') && info.cwd.back() != _S('\\'))
|
||||||
|
#if _WIN32
|
||||||
|
info.cwd += _S('\\');
|
||||||
|
#else
|
||||||
|
info.cwd += _S('/');
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Concatenate args */
|
/* Concatenate args */
|
||||||
std::list<HECL::SystemString> args;
|
std::list<HECL::SystemString> args;
|
||||||
@ -254,7 +262,19 @@ int main(int argc, const char** argv)
|
|||||||
else if (toolName == _S("help"))
|
else if (toolName == _S("help"))
|
||||||
tool.reset(new ToolHelp(info));
|
tool.reset(new ToolHelp(info));
|
||||||
else
|
else
|
||||||
LogModule.report(LogVisor::Error, _S("unrecognized tool '%s'"), toolName.c_str());
|
{
|
||||||
|
FILE* fp = HECL::Fopen(argv[1], _S("rb"));
|
||||||
|
if (!fp)
|
||||||
|
LogModule.report(LogVisor::Error, _S("unrecognized tool '%s'"), toolName.c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Shortcut-case: implicit extract */
|
||||||
|
fclose(fp);
|
||||||
|
info.args.push_front(argv[1]);
|
||||||
|
tool.reset(new ToolExtract(info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (LogVisor::ErrorCount > ErrorRef)
|
if (LogVisor::ErrorCount > ErrorRef)
|
||||||
{
|
{
|
||||||
#if WIN_PAUSE
|
#if WIN_PAUSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user