-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtoolbox-latest
executable file
·37 lines (35 loc) · 1.08 KB
/
toolbox-latest
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
#!/bin/bash
# Define the paths. Don't override in case it's being passed in by trunk check
release_path="${release_path:-./target/release/trunk-toolbox}"
debug_path="${debug_path:-./target/debug/trunk-toolbox}"
fallback_path="trunk-toolbox"
# Check if the release and debug files exist
if [[ -e ${release_path} && -e ${debug_path} ]]; then
# If both files exist, check which one is more recent
if [[ ${release_path} -nt ${debug_path} ]]; then
# If the release file is more recent, execute it
echo "Executing ${release_path}"
${release_path} "$@"
exit $?
else
# If the debug file is more recent, execute it
echo "Executing ${debug_path}"
${debug_path} "$@"
exit $?
fi
elif [[ -e ${release_path} ]]; then
# If only the release file exists, execute it
echo "Executing ${release_path}"
${release_path} "$@"
exit $?
elif [[ -e ${debug_path} ]]; then
# If only the debug file exists, execute it
echo "Executing ${debug_path}"
${debug_path} "$@"
exit $?
else
# If neither file exists, execute the fallback path
echo "Executing ${fallback_path}"
${fallback_path} "$@"
exit $?
fi