TFile.Exists#
Verifica se um arquivo existe no filesystem virtual.
Declaração#
class function Exists(const Path: String): Boolean;Exemplo#
uses
odisseia.io;
begin
TFile.WriteAllText('temp://exists.txt', 'ok');
WriteLn(BoolToStr(TFile.Exists('temp://exists.txt')));
WriteLn(BoolToStr(TFile.Exists('temp://missing.txt')))
end.Resultado esperado: True e depois False.
Permissões: filesystem.read; o preparo do exemplo também exige filesystem.write.
A consulta não cria nem abre o arquivo.
O caminho é resolvido pelo filesystem virtual do host. Caminhos físicos, travessia e escapes por links simbólicos são rejeitados.