Hallo Leute!
Ich bekomme ständig einen IO 32 Fehler, wenn ich mit removeDir oder anderen Methoden ein leeres Verzeichnis löschen möchte.
Warum?
Es greift nichts darauf zu. Auch keine FindNext Mehtode, wo man das FindClose vergessen hat.
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
| function EraseDir(const Directory: TFileName;quiet:Boolean):String; var rnd_str,realPath,gbl_error:string; pname:PChar; Attributes: LongWord; begin Result:=''; pname := PChar(Directory); Attributes := GetFileAttributes(pname); if Attributes = $FFFFFFFF then raise EInOutError.Create(SysErrorMessage(GetLastError)); if (Attributes and file_ATTRIBUTE_readonly) <> 0 then SetFileAttributes(pname, Attributes and not file_ATTRIBUTE_readonly); realPath := WinAPI_GetLongPathName(pname); application.Title := realpath; if Windows.RemoveDirectory(pname) = False then begin if removeDir(realPath) = false then Result := Result + chr(13) + SysErrorMessage(GetLastError) + ': ' + pname + ' IO: ' + inttostr(GetLastError); end; end; |
Moderiert von
Klabautermann: Code- durch Delphi-Tags ersetzt.