chevah/compat — pull request #25 by adiroiban (2014-03-04 22:27:27+00:00)
Title: [#2014] Add support for creating and checking links on Windows.

Problem description
===================

This branch add support for creating symbolic links on Windows and also testing and removing symbolic links.

Changes description
===================

Symbolic links are a bit strange on Windows... on Linux they are just files and are removed using the files API.
On Windows they can be removed with unlink/del but a folder symlink can be removed with both rmdir and del ... but the result is very different as del will delete all content.

See this http://superuser.com/questions/167076/how-can-i-delete-a-symbolic-link

I have updated the Unix API so that deleteFolder can be used for removing a symbolic link. This should give a similar behavior as with Windows API.

I have not implemented deleteFile to work with folder symlinks in Windows as the code would get complicated... and I am not sure that we need this functionality... if we need it, we can implement it.

Now sure why people on internet did not talked about symbolic links to files... and most talks are about symbolic links to folders.

I have not tested symbolic links across different drivers or across network devices... for not such things are not officially supported.

I had to change the implementation of getStatus and isLink and getAttributes. Now getAttributes relies on getLink to check if a path is a link.

I have added missing tests for deleteFile and deleteFolder on top of makeLink tests and isLink

We have lost the support for 'os.lstat' ie getAttributes with follow_links=True but I will fix this in a separate ticket.

readLink implementation will be done in a separate ticket.

How to try and test the changes
===============================

reviewers @alibotean

I have only written unit tests and developed this using only TDD.

Please check that code is ok, but also that it can create symbolic links which can be used on Windows.

Thanks!