mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 17:11:33 +00:00
ESSImport: prevent accidental overwriting of file
This commit is contained in:
parent
a619cff615
commit
ba7cd04ff7
1 changed files with 8 additions and 0 deletions
|
@ -50,8 +50,16 @@ int main(int argc, char** argv)
|
||||||
if (vm.count("compare"))
|
if (vm.count("compare"))
|
||||||
importer.compare();
|
importer.compare();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
const std::string& ext = ".omwsave";
|
||||||
|
if (boost::filesystem::exists(boost::filesystem::path(outputFile))
|
||||||
|
&& (outputFile.size() < ext.size() || outputFile.substr(outputFile.size()-ext.size()) != ext))
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Output file already exists and does not end in .omwsave. Did you mean to use --compare?");
|
||||||
|
}
|
||||||
importer.run();
|
importer.run();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
|
|
Loading…
Reference in a new issue