mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Improve backup file date format
This commit is contained in:
Binary file not shown.
@@ -4326,6 +4326,14 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Configurable max switch combination count for circuit analysis (using org.diylc.maxSwitchCombinations argument)</description>
|
<description>Configurable max switch combination count for circuit analysis (using org.diylc.maxSwitchCombinations argument)</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Added resilience to the code that saves the configuration file to avoid it getting corrupted</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>When backing up the configuration file, append the current timestamp at the end instead of a '~'</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>General application slowness when Inductor component is added to the drawing</description>
|
<description>General application slowness when Inductor component is added to the drawing</description>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -23,11 +23,10 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.time.LocalDateTime;
|
||||||
import java.text.SimpleDateFormat;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@@ -129,15 +128,11 @@ public class AutoSavePlugin implements IPlugIn {
|
|||||||
name = name.substring(0, name.length() - 4);
|
name = name.substring(0, name.length() - 4);
|
||||||
|
|
||||||
// append date and time
|
// append date and time
|
||||||
Date date = new Date();
|
String timestamp = LocalDateTime.now()
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + ".diy");
|
.substring(0, 19)
|
||||||
// make sure that it doesn't already exist
|
.replace(':', '-');
|
||||||
int i = 2;
|
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + timestamp + ".diy");
|
||||||
while (file.exists()) {
|
|
||||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + "-" + i + ".diy");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return file.getAbsolutePath();
|
return file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user