Yukihiro Nakadaira wrote:

> rename() removes file when 'from' and 'to' are same file with different path.
> 
> Steps to reproduce:
> 
>     > echo hello > a.txt
>     > vim
>     :echo rename('a.txt', '.\a.txt')
>     -1
>     (a.txt is removed)
> 
>     > mkdir dir1
>     > mklink /d dir2 dir1
>     > echo hello > dir1\a.txt
>     > vim
>     :echo rename('dir1\a.txt', 'dir2\a.txt')
>     -1
>     (dir1\a.txt is removed)
> 
> 
> The attached patch fixes this problem.
> Changed to use GetFileInformationByHandle() to obtain file identifier
> and compare it to check if 'from' and 'to' are same file.
> Additional clean.diff removes duplicate code.

Thanks for the patch.  Sounds like a similar problem that was solved for
other operating systems.

-- 
Change is inevitable, except from a vending machine.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui