-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmakedslibrary.sh
More file actions
executable file
·53 lines (41 loc) · 1.55 KB
/
Copy pathmakedslibrary.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# @author Fred Brooker <git@gscloud.cz>
# Google Gemini 2.5 Flash - 2025-07-13
# Enable nullglob: If no files match the pattern, the glob expands to nothing,
# preventing the script from trying to process a literal "*.dsbundle".
shopt -s nullglob
# Set Internal Field Separator to newline only to handle filenames with spaces correctly.
IFS=$'\n'
# Flag to check if any .dsbundle directories were found and processed.
found_bundles=false
# Loop through all directories ending with .dsbundle in the current directory.
for bundle_dir in *.dsbundle; do
# Check if the current item is actually a directory.
if [[ -d "$bundle_dir" ]]; then
found_bundles=true
# Construct the output .dslibrary filename.
# We remove the '.dsbundle' extension and append '.dslibrary'.
library_name="${bundle_dir%.dsbundle}.dslibrary"
if [[ -f "$library_name" ]]; then
echo "> '$library_name' already exists"
continue
fi
echo "Archiving '$bundle_dir'..."
# Use the 'zip' command:
# -0 : Store files only, do not compress. This is key for "faster to load".
# -r : Recurse into directories (necessary to archive the entire bundle_dir).
zip -0 -q -r "$library_name" "$bundle_dir"
# Check the exit status
if [[ $? -eq 0 ]]; then
echo "Successfully created '$library_name'."
else
echo "Error creating '$library_name'. Please check the error messages above."
fi
fi
done
if ! $found_bundles; then
echo "No *.dsbundle directories found in the current directory."
fi
echo "Done."
# Restore IFS
unset IFS