Calvin Spealman schrieb: >> I'm thinking of letting my program create hardlinks (or symlinks). I >> know python allows doing this for ext, reiser and the like, but >> apparently not for ntfs systems. >> Is there any package out there that lets me create links in a platform >> independent way? >> > > Why isn't NTFS handled the same as any other hardlink supporting > filesystem? Is it a choice or a bug?
There is no link(2) system call on Win32, hence os.link does not exist on Windows. The file system really has no impact here; all file systems on a system are handled uniformly. The operating system is what matters: Python would allow hard links on NTFS if the operating system is Linux, and would not allow hard links on ext2 if the operating system is Windows XP. Windows supports a CreateHardLink API call since Windows 2000. Python could use that system call to create hard links on Win32; with the Win32 extensions, win32file.CreateHardLink can be used to do so. It would be possible to implement os.link using CreateHardLink. This isn't done because nobody has contributed the code to do so. For previous versions, care would be necessary to not break Windows 9x (which does not have CreateHardLink); for Python 2.6, this requirement could be dropped. Contributions are welcome. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list