mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
ESSImport: prevent accidental overwriting of file
This commit is contained in:
parent
a619cff615
commit
ba7cd04ff7
@ -50,7 +50,15 @@ int main(int argc, char** argv)
|
||||
if (vm.count("compare"))
|
||||
importer.compare();
|
||||
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();
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user