Changed move file to copy and delete in FlatFile.

This commit is contained in:
tastybento 2018-06-23 17:54:51 -07:00
parent 21c259f628
commit 4fc63b6de0

View File

@ -98,9 +98,10 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter {
File tmpFile = File.createTempFile("yaml", null, tableFolder); File tmpFile = File.createTempFile("yaml", null, tableFolder);
yamlConfig.save(tmpFile); yamlConfig.save(tmpFile);
if (tmpFile.exists()) { if (tmpFile.exists()) {
Files.move(tmpFile.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.copy(tmpFile.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.delete(tmpFile.toPath());
} else { } else {
throw new Exception(); throw new IOException();
} }
} catch (Exception e) { } catch (Exception e) {
plugin.logError("Could not save yaml file: " + tableName + " " + fileName + " " + e.getMessage()); plugin.logError("Could not save yaml file: " + tableName + " " + fileName + " " + e.getMessage());