#!/bin/bash
"""
Type: Nautilus Script
Title: Comparer
Version: 1.0
Info: compare deux fichiers ou répertoires.
      compare two files or directories (comparer = to compare).
Author: © Copyright (C) 2013, Airelle - http://rlwpx.free.fr/WPFF/nautilus.htm
Original language: french
License: GNU General Public License, version 3 or later - http://www.gnu.org/licenses/gpl.html
Usage : copier ce fichier dans le répertoire des scripts Nautilus de votre dossier personnel (~/.gnome2/nautilus-scripts/)
        et vérifier que le script est exécutable (x). Le paquet "meld" doit être installé.
        copy this file to the directory of Nautilus-scripts of your home (~/.gnome2/nautilus-scripts/)
        and be sure that the script is executable. Package "meld" must be installed.
"""

IFS='
' 
TMP=/tmp/comparer.tmp
 
if [ $# -gt 1 ]
then
  meld $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
else
  f="$(cat $TMP)"
  if [ "$f" != '' ]
  then
    >$TMP
    meld "$f" $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
  else
    echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS">$TMP
  fi
fi

# EOF
