看来,我想用FileExists()查看的一些文件,即使它们在那里也永远不会被找到,每次都会找到其他文件.
如果我将文件"driver.sys"放入"C:\ Windows\System32\drivers \"目录中,则永远不会找到它(每次调用该函数时FileExists都为false).如果我将文件移动到Windows根目录"C:\ Windows \",则会找到它.
这不起作用(文件肯定在文件夹'C:\ Windows\System32\drivers \'):
function isNotDriverInstalled(): Boolean;
begin
if (FileExists('C:\Windows\System32\drivers\driver.sys')) then begin
Log('File exists');
Result := False;
end else begin
Log('File doesn''t exist');
Result := True;
end;
end;
Run Code Online (Sandbox Code Playgroud)
这有效(当文件位于'C:\ Windows \'文件夹中时):
function isNotDriverInstalled(): Boolean;
begin
if (FileExists('C:\Windows\driver.sys')) then begin
Log('File exists');
Result := False;
end else begin
Log('File doesn''t exist');
Result := True;
end;
end;
Run Code Online (Sandbox Code Playgroud)
顺便说一句:我使用的是Windows 7,64位.
以前有人经历过这样的案子吗?有什么建议?
Thx提前!
inno-setup ×1