Move data directory when station is renamed
This commit is contained in:
parent
8af3162f46
commit
475808acd8
@ -10,6 +10,8 @@ import com.tearsofaunicorn.wordpress.api.model.Post;
|
||||
import com.tearsofaunicorn.wordpress.api.WordpressClient;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
@ -417,6 +419,7 @@ public class StationSettingsController {
|
||||
}
|
||||
}
|
||||
|
||||
Path oldDirectory = settings.stationPath();
|
||||
settings.setAddress(stationAddress.get());
|
||||
settings.setDigitsPerGroup(digitsPerGroup.get());
|
||||
settings.setExternalProgramCommand(externalProgramCommand.get());
|
||||
@ -431,6 +434,14 @@ public class StationSettingsController {
|
||||
settings.setScheduleStartDate(scheduleStartDatePicker.getValue());
|
||||
settings.setUsername(username.get());
|
||||
|
||||
try {
|
||||
if (!oldDirectory.toString().equals(settings.stationPath().toString())) {
|
||||
Files.move(oldDirectory, settings.stationPath());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to move directory", ex);
|
||||
}
|
||||
|
||||
try {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
LocalTime startTime = LocalTime.parse(scheduleStartTimeField.getText(), formatter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user