Fix bug in OpenRecordingsDir action
It used the wrong directory in case of recording dir structure was set to ONE_DIR_PER_RECORDING
This commit is contained in:
parent
53684668ab
commit
985ce12f52
|
@ -6,6 +6,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Model;
|
||||
import ctbrec.Settings.DirectoryStructure;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.controls.Dialogs;
|
||||
import javafx.scene.Cursor;
|
||||
|
@ -24,7 +25,7 @@ public class OpenRecordingsDir {
|
|||
public void execute() {
|
||||
source.setCursor(Cursor.WAIT);
|
||||
File fileForRecording = Config.getInstance().getFileForRecording(selectedModel, ".mp4", Instant.now());
|
||||
File dir = fileForRecording.getParentFile();
|
||||
final File dir = getModelDirectory(fileForRecording);
|
||||
if (dir.exists()) {
|
||||
CompletableFuture.runAsync(() -> DesktopIntegration.open(dir));
|
||||
} else {
|
||||
|
@ -32,4 +33,12 @@ public class OpenRecordingsDir {
|
|||
}
|
||||
source.setCursor(Cursor.DEFAULT);
|
||||
}
|
||||
|
||||
private File getModelDirectory(File fileForRecording) {
|
||||
File dir = fileForRecording.getParentFile();
|
||||
if (Config.getInstance().getSettings().recordingsDirStructure == DirectoryStructure.ONE_PER_RECORDING) {
|
||||
dir = dir.getParentFile();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue