1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-08 19:39:17 +00:00

Code simplified to previous version

This commit is contained in:
Tw93
2025-12-05 23:47:02 +08:00
parent bb9bdffdcf
commit 19adf535f3
4 changed files with 55 additions and 205 deletions

View File

@@ -106,6 +106,7 @@ get_file_size() {
# Get file modification time (epoch seconds) using BSD stat
get_file_mtime() {
local file="$1"
[[ -z "$file" ]] && { echo "0"; return; }
local result
result=$($STAT_BSD -f%m "$file" 2> /dev/null)
echo "${result:-0}"
@@ -1171,6 +1172,7 @@ clean_tool_cache() {
# Returns: size in KB, or 0 if path doesn't exist or error occurs
get_path_size_kb() {
local path="$1"
[[ -z "$path" || ! -e "$path" ]] && { echo "0"; return; }
local result
result=$(command du -sk "$path" 2> /dev/null | awk '{print $1}')
echo "${result:-0}"