Skip to content

Commit

Permalink
fixed cannot trash file if "Trash" is in the filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
tri1976 committed Dec 22, 2012
1 parent 26ea9b2 commit 6882305
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions trash/trash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
COMMENT

version="trash v0.3.8"
version="trash v0.3.9"

function info {
for i; do
Expand Down Expand Up @@ -63,16 +63,16 @@ function movetotrash {
echo "$i doesn't exist"
continue
fi
if echo $i | grep -q /*Trash.*/; then
echo "cannot trash $i because it's already in the trashcan"
continue
fi
if [[ `stat -c %s "$i"` -gt $maxsize ]]; then
echo "skip $i because it's larger than $maxsize"
continue
fi
topdir=`stat -c %m "$i"`
[[ $topdir == $trashcan_mntpoint ]] && localtrash=$trashcan || localtrash=$topdir/.Trash-$USER
if echo $i | grep -q $localtrash; then
echo "cannot trash $i because it's already in the trashcan"
continue
fi
if mkdir -p "$localtrash"/{files,info}; then
chmod --quiet +t "$localtrash"/{files,info}
else
Expand Down

0 comments on commit 6882305

Please sign in to comment.