geraldholdsworth / DiscImageManager

To manage retro floppy disc images
https://www.geraldholdsworth.co.uk
GNU General Public License v3.0
79 stars 8 forks source link

access violation upon renaming file #28

Closed dmcoles closed 1 year ago

dmcoles commented 1 year ago

caused when a dos partition is present and you rename a file in the adfs partition

(see also issue #27)

geraldholdsworth commented 1 year ago

Well spotted, although I can't see a reason why this would cause the error you are experiencing. The worst that would happen, without these changes, would be that one can't rename a file on the DOS or AFS partition. I can only think that there must be another bug hidden deeper in the code to cause your issue.

dmcoles commented 1 year ago

Well spotted, although I can't see a reason why this would cause the error you are experiencing. The worst that would happen, without these changes, would be that one can't rename a file on the DOS or AFS partition. I can only think that there must be another bug hidden deeper in the code to cause your issue.

i can't remember exactly where it crashed out with a nil pointer but because the filename of the image matched the first part of the dosrootname it went into the RenameDOSFile function and then crashed out somewhere further down the code where the shortfilename property was nil.

if LeftStr(oldfilename,Length(dosrootname))=dosrootname then begin Result:=RenameDOSFile(oldfilename,newfilename); exit; end;

geraldholdsworth commented 1 year ago

Of course...silly me. If it is being run on Windows then of course 'filename' will be a DOS style filename and could well be a match for the DOS root name. I can't replicate it because I'm not using Windows.