GideonZ / 1541ultimate

Official GIT archive of 1541 ultimate II sources
GNU General Public License v3.0
173 stars 45 forks source link

Fix renaming files in DNP iamge #317

Closed markusC64 closed 1 year ago

markusC64 commented 1 year ago

Renaming files in DNP images did not work in subdirectories

markusC64 commented 1 year ago

I think moving files would not work.

Perhaps we should distinguish between renaming and moving. Moving is more complex because you have to differ between moves inside a filesystem and moves between filesystems. Seperate calls for move might therefore make sense.

GideonZ commented 1 year ago

Agreed. To some extent. The move operation falls apart into checking whether source and destination are in the same file system. If so, it should call 'rename' of that particular filesystem. If not, it should either give an error, or perform a copy & delete on success. You cannot always do a copy & delete when the source and destination are on the same filesystem, because there might not be enough space for a copy of the same file. So, I stick to my original statement, that a rename should support moving between directories. Unless all filesystems get a 'move' operation, which is ... a different implementation of rename?

Message ID: @.***>

markusC64 commented 1 year ago

I think move and rename are quite different. rename operates in exactly one directory and it is sufficient to change an existing directory entry (only the name part). In contrast to move. It operates on two directories, it has to invalidate the source directory entry and create a new directory anty in the destination directory.

So separated implementation makes sense. And a function "renameOrMove" could call what matches for the actual call.