Nadeem Vawda <nadeem.va...@gmail.com> added the comment:

> BTW,what is the best way to check for case insensitive file-system?
> The test here merely checks if sys.platform returns mac, darwin or win32.
I would suggest not checking at all. If the system is case-sensitive, the test 
will pass, so it doesn't really make a difference. You could write a small 
function that creates a dummy file and then tries to access it via a case 
variant of its name, but that seems unnecessary.

> You can't solve this by trying to do different things on different
> operating systems. This bug depends on file system properties, not OS.
It's worth pointing out that it depends on both the FS *and* OS. For example, 
an NTFS filesystem is case-insensitive under Windows, but case-sensitive under 
Linux. This has caused me headaches in the past.

> I still think the best avenue would be to first try straight os.rename,
> and if that fails (maybe only if target exists), the logic
> that is currently in shutil.move.
I agree. If os.rename() succeeds, there is no need to copy the file and then 
delete the original. If it fails because the two paths are on different 
devices, the existing code can safely be used without any further checks. I'm 
not sure if there are any other failure cases that would need to be handled, 
though.

----------
nosy: +nvawda

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10684>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to