Compare commits

..

1 Commits

Author SHA1 Message Date
394ad6e891 added extract_icon function 2025-07-18 13:04:17 +06:00

View File

@ -483,6 +483,41 @@ var_ld_library_path_update () {
return 0 return 0
} }
extract_icon() {
check_prefix_var
local exe_file="$1"
local ico_name="$(basename "$exe_file" .exe).ico"
local png_name="$(basename "$exe_file" .exe).png"
local tmp_ico_dir="$WH_TMP_DIR/icons"
local user_icons="$WINEPREFIX/icons"
create_new_dir "$tmp_ico_dir"
if ! wrestool -x -t 14 "$exe_file" -o "$tmp_ico_dir/$ico_name" ; then
print_warning "Не удалось извлечь иконку из $exe_file"
try_remove_file "$tmp_ico_dir"
return 1
fi
if ! icotool -x -i 1 "$tmp_ico_dir/$ico_name" -o "$tmp_ico_dir/$png_name" ; then
print_warning "Не удалось извлечь иконку из $ico_name"
try_remove_file "$tmp_ico_dir"
return 1
fi
create_new_dir "$user_icons"
if ! try_copy_file "$tmp_ico_dir/$png_name" "$user_icons" ; then
print_warning "Не удалось копировать иконку в префикс"
try_remove_file "$user_icons"
return 1
fi
try_remove_dir "$tmp_ico_dir"
print_ok "Иконка сохранена: $user_icons/$png_name"
return 0
}
create_desktop () { create_desktop () {
local name_desktop exe_file desktop_filename icon_file desktop_path local name_desktop exe_file desktop_filename icon_file desktop_path
name_desktop="$1" name_desktop="$1"