morgant/tools-osx — pull request #6 by mbrictson (2012-01-05 22:19:54+00:00)
Title: Fix bug where trash ../file would trash cwd

Use ruby's File.expand_path to properly convert relative paths to absolute paths before sending to the Finder via AppleScript.

Previously, the absolute path was obtained with simple concatentation, such that `trash ../file` would be converted to `trash /path/to/cwd/../file`. When given this path, Finder would trash `/path/to/cwd` and then fail with an error. Yikes!

With ruby's File.expand_path, `trash ../file` is converted to `trash /path/to/file`, and Finder trashes the intended file.