mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Upgraded "input-file" command line option to Files::MaybeQuotedPath from std::string to allow unicode characters on Windows.
This commit is contained in:
parent
e5c417c968
commit
6bf4c7a04f
3 changed files with 26 additions and 22 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <components/bsa/compressedbsafile.hpp>
|
||||
#include <components/misc/strings/algorithm.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#define BSATOOL_VERSION 1.1
|
||||
|
||||
|
@ -112,37 +113,39 @@ bool parseOptions (int argc, char** argv, Arguments &info)
|
|||
<< desc << std::endl;
|
||||
return false;
|
||||
}
|
||||
info.filename = variables["input-file"].as< std::vector<std::string> >()[0]; //TODO(Project579): This will probably break in windows with unicode paths
|
||||
auto inputFiles = variables["input-file"].as< std::vector<Files::MaybeQuotedPath> >();
|
||||
|
||||
info.filename = inputFiles[0];
|
||||
|
||||
// Default output to the working directory
|
||||
info.outdir = ".";
|
||||
|
||||
if (info.mode == "extract")
|
||||
{
|
||||
if (variables["input-file"].as< std::vector<std::string> >().size() < 2)
|
||||
if (inputFiles.size() < 2)
|
||||
{
|
||||
std::cout << "\nERROR: file to extract unspecified\n\n"
|
||||
<< desc << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
|
||||
info.extractfile = variables["input-file"].as< std::vector<std::string> >()[1];
|
||||
if (variables["input-file"].as< std::vector<std::string> >().size() > 2)
|
||||
info.outdir = variables["input-file"].as< std::vector<std::string> >()[2];
|
||||
if (inputFiles.size() > 1)
|
||||
info.extractfile = inputFiles[1];
|
||||
if (inputFiles.size() > 2)
|
||||
info.outdir = inputFiles[2];
|
||||
}
|
||||
else if (info.mode == "add")
|
||||
{
|
||||
if (variables["input-file"].as< std::vector<std::string> >().size() < 1)
|
||||
if (inputFiles.empty())
|
||||
{
|
||||
std::cout << "\nERROR: file to add unspecified\n\n"
|
||||
<< desc << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
|
||||
info.addfile = variables["input-file"].as< std::vector<std::string> >()[1];
|
||||
if (inputFiles.size() > 1)
|
||||
info.addfile = inputFiles[1];
|
||||
}
|
||||
else if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
|
||||
info.outdir = variables["input-file"].as< std::vector<std::string> >()[1];
|
||||
else if (inputFiles.size() > 1)
|
||||
info.outdir = inputFiles[1];
|
||||
|
||||
info.longformat = variables.count("long") != 0;
|
||||
info.fullpath = variables.count("full-path") != 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue