Skip to content

Commit 89e9145

Browse files
authored
Merge pull request #3 from ivstiv/clean-app-images
Clean app images that have been automatically downloaded by cursor
2 parents e1d7d56 + d75d686 commit 89e9145

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

cvm.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#
3636
CURSOR_DIR="$HOME/.local/share/cvm"
3737
DOWNLOADS_DIR="$CURSOR_DIR/app-images"
38-
CVM_VERSION="1.1.1"
38+
CVM_VERSION="1.1.2"
3939

4040

4141

@@ -207,6 +207,27 @@ isShellSupported() {
207207
esac
208208
}
209209

210+
cleanupAppImages() {
211+
for build_file in "$DOWNLOADS_DIR"/cursor-*-build-*-x86_64.AppImage; do
212+
# Skip if no files match the pattern
213+
[ -e "$build_file" ] || continue
214+
215+
# Extract version number from build file
216+
version=$(basename "$build_file" | sed -E 's/cursor-([0-9.]+)-build.*/\1/')
217+
regular_file="$DOWNLOADS_DIR/cursor-$version.AppImage"
218+
219+
if [ -f "$regular_file" ]; then
220+
# If regular version exists, remove build version
221+
rm "$build_file"
222+
# echo "Removed build version for $version (regular version exists)"
223+
else
224+
# If only build version exists, rename it to regular format
225+
mv "$build_file" "$regular_file"
226+
# echo "Renamed build version to regular format for $version"
227+
fi
228+
done
229+
}
230+
210231

211232

212233
#
@@ -222,6 +243,7 @@ fi
222243

223244
checkDependencies
224245
mkdir -p "$DOWNLOADS_DIR"
246+
cleanupAppImages
225247

226248
case "$1" in
227249
--help|-h)

0 commit comments

Comments
 (0)