file.contains works with ~ in filename

Fixed #367.Similar patch to this https://github.com/fabric/fabric/commit/0bc58aa11477ecb0f6c770fbce65822dfdc52498