Expands path on file operations

Path might have to be expanded on some operations. It seems that path
containing '~' are not.
Using os.path.expanduser in appropriate places solves the problem, but
this might be required in many other places.
Adds path expansion to two other methods

set_owner_if_different and set_group_if_different seems to need path
expansion too
Merge pull request #1821 from leucos/path-expand-fix

Expands path on file operations