home/modules/prism-launcher: look for screens in new instance data location

This commit is contained in:
2025-05-04 21:14:32 +02:00
parent a53f2a9a1e
commit 8e15ae90db

View File

@@ -43,7 +43,10 @@ in
Install.WantedBy = [ "paths.target" ]; Install.WantedBy = [ "paths.target" ];
Unit.Description = "Watchdog that moves screenshots from all prismlauncher minecraft instances into a common dir"; Unit.Description = "Watchdog that moves screenshots from all prismlauncher minecraft instances into a common dir";
Path = { Path = {
PathExistsGlob = [ "${cfg.stateDir}/instances/*/.minecraft/screenshots/*.png" ]; PathExistsGlob = [
"${cfg.stateDir}/instances/*/.minecraft/screenshots/*.png"
"${cfg.stateDir}/instances/*/minecraft/screenshots/*.png"
];
Unit = "prismlauncher-move-minecraft-screenshots.service"; Unit = "prismlauncher-move-minecraft-screenshots.service";
TriggerLimitIntervalSec = "1s"; TriggerLimitIntervalSec = "1s";
TriggerLimitBurst = "1"; TriggerLimitBurst = "1";
@@ -67,13 +70,17 @@ in
INSTANCE_NAME="''${INSTANCE_NAME%'/'}" INSTANCE_NAME="''${INSTANCE_NAME%'/'}"
SCREENSHOT_TARGET_DIR="${cfg.screenshotMover.screenshotDir}/$INSTANCE_NAME" SCREENSHOT_TARGET_DIR="${cfg.screenshotMover.screenshotDir}/$INSTANCE_NAME"
mkdir -p "''${SCREENSHOT_TARGET_DIR}" mkdir -p "''${SCREENSHOT_TARGET_DIR}"
if [ -d "${instancesDir}/$INSTANCE_NAME"/.minecraft/screenshots ]; then for variant in minecraft .minecraft; do
for screenshot in "${instancesDir}/$INSTANCE_NAME"/.minecraft/screenshots/*.png; do SCREENSHOT_SOURCE_DIR="${instancesDir}/$INSTANCE_NAME/$variant"/screenshots
echo "Moving '$screenshot' -> '$SCREENSHOT_TARGET_DIR'" if [ -d "$SCREENSHOT_SOURCE_DIR" ]; then
cp --preserve=all "$screenshot" "$SCREENSHOT_TARGET_DIR" echo "Scanning for screenshots in $SCREENSHOT_SOURCE_DIR"
rm "$screenshot" for screenshot in "$SCREENSHOT_SOURCE_DIR"/*.png; do
echo "Moving '$screenshot' -> '$SCREENSHOT_TARGET_DIR'"
cp --preserve=all "$screenshot" "$SCREENSHOT_TARGET_DIR"
rm "$screenshot"
done
fi
done done
fi
done done
''; '';
}); });