copy now copy all the contents of the image folder and renaming is much more faster because does not imply a copy but just a moveTo: and a renaming
MODIFY
src/PharoLauncher-Core.package/PhLDirectoryBasedImageRepository.class/instance/copyImageNamed.to..st
src/PharoLauncher-Core.package/PhLDirectoryBasedImageRepository.class/instance/copyImageNamed.to..st
@@ -4,9 +4,6 @@ copyImageNamed: sourceName to: targetName
self ensureNoImageWithName: targetName.
targetDirectory := self prepareForNewImageNamed: targetName.
sourceDirectory := self directoryForImageNamed: sourceName.
- sourceDirectory children
- do: [ :file |
- | targetFilename |
- targetFilename := self newNameForFile: file whenRelocatingToImageNamed: targetName.
- file copyTo: targetDirectory / targetFilename ].
- self contentsChanged.
\ No newline at end of file
+ CopyVisitor copy: sourceDirectory to: targetDirectory.
+ self renameImageInFolder: targetDirectory to: targetName.
+ self contentsChanged
\ No newline at end of file

ADD
src/PharoLauncher-Core.package/PhLDirectoryBasedImageRepository.class/instance/renameImageInFolder.to..st
+private
+renameImageInFolder: targetDirectory to: newName
+ targetDirectory children
+ do: [ :file |
+ | targetFilename |
+ targetFilename := self
+ newNameForFile: file
+ whenRelocatingToImageNamed: newName.
+ file basename = targetFilename
+ ifFalse: [ file renameTo: targetFilename ] ]
\ No newline at end of file

MODIFY
src/PharoLauncher-Core.package/PhLDirectoryBasedImageRepository.class/instance/renameImageNamed.to..st
src/PharoLauncher-Core.package/PhLDirectoryBasedImageRepository.class/instance/renameImageNamed.to..st
@@ -2,12 +2,8 @@ action
renameImageNamed: oldName to: newName
| sourceDirectory targetDirectory |
self ensureNoImageWithName: newName.
- targetDirectory := self prepareForNewImageNamed: newName.
+ targetDirectory := self directoryForImageNamed: newName. "Do not create a new directory to ensure that the moveTo will succeed"
sourceDirectory := self directoryForImageNamed: oldName.
- sourceDirectory children
- do: [ :file |
- | targetFilename |
- targetFilename := self newNameForFile: file whenRelocatingToImageNamed: newName.
- file moveTo: targetDirectory / targetFilename ].
- sourceDirectory delete.
- self contentsChanged.
\ No newline at end of file
+ sourceDirectory moveTo: targetDirectory.
+ self renameImageInFolder: targetDirectory to: newName.
+ self contentsChanged
\ No newline at end of file

copy now copy all the contents of the image folder and renaming is much more faster because does not imply a copy but just a moveTo: and a renaming