-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathAPI_DRFL_CLEAN.sh
More file actions
executable file
·57 lines (48 loc) · 1.29 KB
/
API_DRFL_CLEAN.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.29 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
54
55
56
57
#!/bin/bash
# Navigate to the example directory
cd example/Linux_64 || { echo "Directory 'example/Linux_64' not found. Exiting."; exit 1; }
# Check if there are any files to clean
OBJ_FILES=(*.o)
OUT_DIR="./out"
FOUND_FILES=false
# Check for .o files
if [[ -f "${OBJ_FILES[0]}" ]]; then
echo "Found object files:"
for obj in "${OBJ_FILES[@]}"; do
echo " $obj"
done
FOUND_FILES=true
fi
# Check for out directory and executables
if [[ -d "$OUT_DIR" ]]; then
EXECUTABLES=($(find "$OUT_DIR" -type f -executable))
if [[ ${#EXECUTABLES[@]} -gt 0 ]]; then
echo "Found executables in out/ directory:"
for exe in "${EXECUTABLES[@]}"; do
echo " $(basename "$exe")"
done
FOUND_FILES=true
fi
fi
if [[ "$FOUND_FILES" == false ]]; then
echo "No build files found to clean."
exit 0
fi
# Ask for confirmation
read -p "Do you want to clean all build files? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Remove .o files
if [[ -f "${OBJ_FILES[0]}" ]]; then
rm -f *.o
echo "Removed object files."
fi
# Remove out directory
if [[ -d "$OUT_DIR" ]]; then
rm -rf "$OUT_DIR"
echo "Removed out/ directory."
fi
echo "Clean completed."
else
echo "Clean cancelled."
fi