mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-03 06:28:48 +00:00
Remember last export folder & ensure default output name is unique
This commit is contained in:
1 parent
c4217d1acd
commit
b8b22db8ee
1 file changed
+11
-1
@@ -26,6 +26,7 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ public class StartExportWindow {
|
|||||||
private static boolean recordAudio = false;
|
private static boolean recordAudio = false;
|
||||||
private static AudioCodec audioCodec = AudioCodec.AAC;
|
private static AudioCodec audioCodec = AudioCodec.AAC;
|
||||||
|
|
||||||
|
private static Path defaultExportPath = null;
|
||||||
private static final ImString jobName = ImGuiHelper.createResizableImString("");
|
private static final ImString jobName = ImGuiHelper.createResizableImString("");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -214,7 +216,9 @@ public class StartExportWindow {
|
|||||||
|
|
||||||
String encoder = videoCodec.getEncoders()[selectedVideoEncoder[0]];
|
String encoder = videoCodec.getEncoders()[selectedVideoEncoder[0]];
|
||||||
|
|
||||||
Path defaultExportPath = FabricLoader.getInstance().getGameDir();
|
if (defaultExportPath == null || !Files.exists(defaultExportPath)) {
|
||||||
|
defaultExportPath = FabricLoader.getInstance().getGameDir();
|
||||||
|
}
|
||||||
|
|
||||||
String defaultName = null;
|
String defaultName = null;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@@ -222,6 +226,11 @@ public class StartExportWindow {
|
|||||||
defaultName = FileUtil.findAvailableName(defaultExportPath, name, "." + container.extension());
|
defaultName = FileUtil.findAvailableName(defaultExportPath, name, "." + container.extension());
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
if (defaultName == null) {
|
||||||
|
try {
|
||||||
|
defaultName = FileUtil.findAvailableName(defaultExportPath, "output", "." + container.extension());
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
if (defaultName == null) {
|
if (defaultName == null) {
|
||||||
defaultName = "output." + container.extension();
|
defaultName = "output." + container.extension();
|
||||||
}
|
}
|
||||||
@@ -251,6 +260,7 @@ public class StartExportWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path path = Path.of(pathStr);
|
Path path = Path.of(pathStr);
|
||||||
|
defaultExportPath = path.getParent();
|
||||||
return new ExportSettings(name, editorState.copy(),
|
return new ExportSettings(name, editorState.copy(),
|
||||||
player.position(), player.getYRot(), player.getXRot(),
|
player.position(), player.getYRot(), player.getXRot(),
|
||||||
resolution[0], resolution[1], start, end,
|
resolution[0], resolution[1], start, end,
|
||||||
|
|||||||
Reference in new issue
Block a user