检查目录是否可读

use*_*601 7 delphi

我们如何检查目录是否是readOnly或Not?

RRU*_*RUZ 4

您可以使用该FileGetAttr函数并检查该faReadOnly标志是否已设置。

试试这个代码

function DirIsReadOnly(Path:string):Boolean;
var
 attrs    : Integer;
begin
 attrs  := FileGetAttr(Path);
 Result := (attrs  and faReadOnly) > 0;
end;
Run Code Online (Sandbox Code Playgroud)