forked from CastroFidel/winehelper
Compare commits
1 Commits
changelog_
...
extract_ic
Author | SHA1 | Date | |
---|---|---|---|
394ad6e891 |
@ -4,7 +4,7 @@ _winehelper_completions() {
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
opts="--help --version --debug install installed -r -i remove-all --clear-pfx killall remove-prefix backup-prefix restore-prefix --changelog changelog"
|
opts="--help --version --debug install installed -r -i remove-all --clear-pfx killall remove-prefix backup-prefix restore-prefix"
|
||||||
wine_cmd="winecfg winereg winefile wineconsole winetricks desktop regedit explorer cmd run"
|
wine_cmd="winecfg winereg winefile wineconsole winetricks desktop regedit explorer cmd run"
|
||||||
|
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
|
35
winehelper
35
winehelper
@ -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"
|
||||||
|
Reference in New Issue
Block a user