File Browser: Rename capitals<->lowercase not supported #71772
Labels
No Label
legacy module
Animation & Rigging
legacy module
Core
legacy module
Eevee & Viewport
legacy module
Modeling
legacy module
Platforms, Builds, Tests & Devices
legacy module
Rendering & Cycles
legacy module
User Interface
legacy module
VFX & Video
legacy project
2.81
legacy project
Animation & Rigging
legacy project
BF Blender: 2.8
legacy project
BF Blender: After Release
legacy project
BF Blender: Next
legacy project
Core
legacy project
Cycles
legacy project
EEVEE & Viewport
legacy project
Modeling
legacy project
Modifiers
legacy project
Overrides
legacy project
Platform: Windows
legacy project
Render Pipeline
legacy project
User Interface
legacy project
Video Sequencer
Priority::Normal
Status::Archived
Status::Duplicate
Status::Resolved
Type::Bug
Type::Patch
Type::Report
No Milestone
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: archive/blender-file#71772
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: 26bd5ebd42e3, type: Release
build date: 2019-11-20, 16:33:00
platform: Windows
Short description of error
Capitals can't be renamed in lowercase and vice versa.
Exact steps for others to reproduce the error
Example:
When I try to rename "filename.blend" to "Filename.blend", it doesn't work.
I've to rename it to a different letter first, before renaming it to the real name.
Added subscriber: @ChristophWerner
File Manager: Rename capitals not supportetto File Manager: Rename capitals not supportedFile Manager: Rename capitals not supportedto File Manager: Rename capitals<->lowercase not supportedFile Manager: Rename capitals<->lowercase not supportedto File Browser: Rename capitals<->lowercase not supportedAdded subscriber: @McSwiff
This is a core issue with Windows. It cannot tell the difference between a path with different capitalization. This is a problem that boggles the mind of everybody who develops with Windows. You can see it if you try to make a "File.txt" and "file.txt" next to each other: Windows will not allow it because it will tell you a file under that same name already exists.
Though you'd think you could automatically apply the workaround you described (rename to something else, then to the final name), this would cause issues for users with .blend files in network drives or folders managed by version control.
Thank you for the answer.
I've tried it in the regular Windows 10 Explorer and all works fine there. I can rename a lowercase into a capital and vice versa.
The same I've tried with my favorite file manager "Total Commander". There it works, too.
Are you sure there is really still a global windows issue? I'm just asking as a end user.
The renaming between File and file is working in explorer I see. But an application asking Windows to rename File to file still won't work.
You can see that Windows doesn't see the difference between 'test' and 'Test' in this screenshot, where I already have a file 'test', then when I rename another file to 'Test' (with a capital), Windows throws this up:
The cause is described here too:
https://en.wikipedia.org/wiki/Filename#Letter_case_preservation
Yes, your example is logical if you already have a file, that has the same name.
But is it the same what I say above? Do I misunderstand something?
Yes, renaming does work correctly from Windows Explorer directly; probably they do work around the issue with the filesystem directly which is easier as an OS. Renaming 2 files to "test" and "Test" is an example I gave as a way to expose the underlying issue.
OK. Nevertheless this should be fixed.
For the user it is not really understandable, why Blender can't rename a single Letter in a filename, but all other apps can do it.
Best wishes
Chris
Added subscriber: @mano-wii
How do you rename a file by the blender file browser?
Added subscriber: @Harley
You can right-click on any file name and select "Rename" from the context menu.
In a nutshell we are specifically not allowing a rename that involves nothing but a change of case on Windows. It is indirectly because on Windows our file systems are case-preserving but case-insensitive. So we can save file names that have mixed case like "Mixed.text", but cannot have two files in the same location with same name like "Mixed.txt" and "mixed.txt" together.
So when attempting a rename that involves only a case change we are first checking if the new and old names are equal. In this case that is not true so we continue. But then we check if a file of the new name already exists. In this case it is true so we don't allow the rename to continue. blender\editors\space_file\file_draw.c, renamebutton_cb()
If we did not do this test for file existance (BLI_exists) then the requested case-change rename would work. However, it would screw up in the situation where the new file name really does already exist. So in the case of renaming "one.txt" to "two.txt" when we already have a "two.txt". In that case our BLI_rename() will happily do so, deleting "two.txt" and renaming "one.txt" to "two.txt".
It would be hard to deal with these two situation separately because in both cases the new name is an existing file. It would add complication and probably have corner cases that are hard to anticipate. We could check to see if new file exists but is the same as old file case-insensitively, but that would screw up if a user is actually using a file system that is case-sensitive.
I'd say the best thing is just treat this as a quirk of your operating system and do it in two steps. If you want to change just the case of file? Change it to some other name first then change back while also changing case. So "mixed.txt" -> "_mixed.txt -> "Mixed.txt". Or rename it outside of the File Browser.
Changed status from 'Open' to: 'Archived'
In my case, since I use Right Click Select, the button is W.
It is strange but follows the convention of the context menu.
It might be a good idea to keep both keys in this case.
But that's another issue.
@Harley, what do you think is best:
Changed status from 'Archived' to: 'Open'
I honestly don't think it can be a "to do".
And although it seems odd, I don't really even consider it a limitation for Windows. The test for "Does this file exist?" definitely returns what it is expected for any system that is case-insensitive. I honestly don't know how we could deal with this special case in a way that would not screw up if you connected to a Linux share through Samba where there were existing files that then appeared duplicated. In that case BLI_rename() would delete the file of the new name before renaming.
This workaround, having to rename twice when just changing case, was something we dealt with in the Windows File Manager for years - since 1995 - and was only just changed (finally) recently with Windows 10.
Changed status from 'Open' to: 'Archived'
Closing then.
It's not worth creating an internal workaround that messes up the code to solve this.
Small update what windows does, if you rename a file from "myimage.png" to "Myimage.png" in a different folder.
If you copy the renamed version then to a folder where a version exists that is named in the orgin spelling "myimage.png", the following happens:
Windows realise there is already a filename with same name, and ask to overwrite it.
So Windows is basically doing, what every system does, but in the case of renaming it allows the user to rename a single Letter of a filename inside a folder.
Just for info.