[Wine] Re: Wine menus - rebuilding, deleting

IntuitiveNipple wineforum-user at winehq.org
Mon May 4 08:46:28 CDT 2009


Thanks for the work you did on this - I needed it to clean out some messy entries in Gnome after moving a $HOME structure to a newer Ubuntu release - the original menu's had their titles messed up in ~/.local/share/applications/

I rewrote your script to use shell constructs instead of 'find'. I've copied it here for others to play with.

Code:

#!/bin/sh

wine="wine"
rm="/bin/rm"

iterate_start_menu ()
{
 local menu_dir
 local oldIFS
 menu_dir=$1
 # don't use space as field-separator otherwise "paths with spaces" will fail to parse correctly
 oldIFS=$IFS
 IFS=?
 echo "menu_dir=${menu_dir}"
 # add a trailing slash to the directory name, then the glob wildcard
 for entry in ${menu_dir}/*; do
  if [ -f "$entry" ]; then
	echo "Link: $entry";
    "$wine" winemenubuilder "$entry"
  elif [ -d "$entry" ]; then
	echo "Directory: $entry";
	iterate_start_menu "$entry"
  else
	echo "is unknown";
  fi
 done

 IFS=$oldIFS
}

# Delete current user-defined wine menus
"$rm" -f $HOME/.config/menus/applications-merged/wine*
"$rm" -rf $HOME/.local/share/applications/wine

# Rebuild Start Menu for all prefixes starting with ".wine-"
for prefix in "$HOME/".wine-*; do
 WINEPREFIX="$prefix"
 export WINEPREFIX
 # do not use a trailing / at the end of the directory name
 iterate_start_menu "${WINEPREFIX}/drive_c/windows/profiles/*/Start Menu"
done










More information about the wine-users mailing list