You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gnome-commander/mimeedit-svn1958.diff

41 lines
1.3 KiB

Index: mimeedit.sh
===================================================================
--- mimeedit.sh (revision 1958)
+++ mimeedit.sh (working copy)
@@ -342,6 +342,7 @@
# The .desktop file editor
#
function dtfedit (){
+ TMPFILE=`mktemp /tmp/gnome-commander.XXXXXX`
USER_DTF="$DT_FILE-$EXT"
if [ -n "$DT_FILE" ]
then
@@ -350,15 +351,22 @@
then
TO_EDIT="$DATA_DIR/$USER_DTF"
else
- TO_EDIT="$GDATA_DIR/$DT_FILE.desktop"
+ DT_FILE_PREFIX=$(echo $DT_FILE | sed -e 's|-[0-9][0-9]*||')
+ DT_FILE_SUFFIX=$(echo $DT_FILE | sed -n -e 's|^.*-\([0-9][0-9]*\)$|\1|p')
+ if [ -e $DATA_DIR/${DT_FILE_PREFIX}-usercreated-$DT_FILE_SUFFIX.desktop ]
+ then
+ TO_EDIT="$DATA_DIR/${DT_FILE_PREFIX}-usercreated-$DT_FILE_SUFFIX.desktop"
+ else
+ TO_EDIT="$GDATA_DIR/$DT_FILE.desktop"
+ fi
fi
cat "$TO_EDIT" | zenity --height="350" --width="550" --text-info --editable \
- --title "Edititng the file: $USER_DTF" > $UTMP.$USER_DTF
- if [ -s $UTMP.$USER_DTF ]
+ --title "Edititng the file: $USER_DTF" > $TMPFILE
+ if [ -s $TMPFILE ]
then
- mv $UTMP.$USER_DTF $DATA_DIR/$USER_DTF
+ mv $TMPFILE $DATA_DIR/$USER_DTF
else
- rm -f $UTMP.$USER_DTF
+ rm -f $TMPFILE
DT_FILE=""
fi
fi