-
-
Notifications
You must be signed in to change notification settings - Fork 152
FileSystem::rename() fix renaming file/directory if only case changes #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When trying to rename file/directory itself in order to change only case of filename (eg. `test.php` to `Test.php`), the process fails as the method first [deletes](https://github.com/nette/utils/blob/master/src/Utils/FileSystem.php#L110) the desired file(name) prior to renaming it .. thus it deletes the original file/dir that was about to be renamed.
Good point. However, checking whether the files are the same should be done differently (I don't know how). For compatibility between NTFS and Linux. |
@dg you think |
Maybe compare |
I think the |
Realpath should do the work, I didn’t test it. It this case there shouldn’t be lower(). |
@dg updated |
Did you test it? I am not sure that realpath really works this way. |
@dg I did.. on OS preventing same filenames differing in case only, like Windows, realpath correctly transforms eg |
Great. But it seems that it breaks test… |
@dg should I remove the failing test altogether? As the failing |
Thanks, merged |
When trying to rename file/directory itself in order to change only case of filename (eg.
test.php
toTest.php
), the process fails as the method first deletes the desired file(name) prior to renaming it .. thus it deletes the original file/dir that was about to be renamed.This change prevents that case.