Handle tilde in file name (contrib.files)

Fixed #367.