From eb1803aa0f6bdccaafde3a47fde67206e44e55d2 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 3 Jan 2018 13:52:23 -1000 Subject: [PATCH] Implement -o flag for extracting --- hecl/driver/ToolExtract.hpp | 39 ++++++++++++++++++++++++------------- hecl/extern/athena | 2 +- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/hecl/driver/ToolExtract.hpp b/hecl/driver/ToolExtract.hpp index a252f14b0..e6c14b194 100644 --- a/hecl/driver/ToolExtract.hpp +++ b/hecl/driver/ToolExtract.hpp @@ -35,22 +35,35 @@ public: if (!info.project) { - /* Get name from input file and init project there */ - hecl::SystemString baseFile = info.args.front(); - size_t slashPos = baseFile.rfind(_S('/')); - if (slashPos == hecl::SystemString::npos) - slashPos = baseFile.rfind(_S('\\')); - if (slashPos != hecl::SystemString::npos) - baseFile.assign(baseFile.begin() + slashPos + 1, baseFile.end()); - size_t dotPos = baseFile.rfind(_S('.')); - if (dotPos != hecl::SystemString::npos) - baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos); + hecl::SystemString rootDir; - if (baseFile.empty()) - LogModule.report(logvisor::Fatal, "hecl extract must be ran within a project directory"); + if (info.output.empty()) + { + /* Get name from input file and init project there */ + hecl::SystemString baseFile = info.args.front(); + size_t slashPos = baseFile.rfind(_S('/')); + if (slashPos == hecl::SystemString::npos) + slashPos = baseFile.rfind(_S('\\')); + if (slashPos != hecl::SystemString::npos) + baseFile.assign(baseFile.begin() + slashPos + 1, baseFile.end()); + size_t dotPos = baseFile.rfind(_S('.')); + if (dotPos != hecl::SystemString::npos) + baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos); + + if (baseFile.empty()) + LogModule.report(logvisor::Fatal, "hecl extract must be ran within a project directory"); + + rootDir = info.cwd + baseFile; + } + else + { + if (hecl::PathRelative(info.output.c_str())) + rootDir = info.cwd + info.output; + else + rootDir = info.output; + } size_t ErrorRef = logvisor::ErrorCount; - hecl::SystemString rootDir = info.cwd + baseFile; hecl::ProjectRootPath newProjRoot(rootDir); newProjRoot.makeDir(); m_fallbackProj.reset(new hecl::Database::Project(newProjRoot)); diff --git a/hecl/extern/athena b/hecl/extern/athena index 87f213bc0..ec49377fc 160000 --- a/hecl/extern/athena +++ b/hecl/extern/athena @@ -1 +1 @@ -Subproject commit 87f213bc0bba888eeea4e614162a8b3b918bcbf8 +Subproject commit ec49377fcd20748ae4490cd18afc9abefa11e7be