function LongFileName (ShortName: string): string;
var SR: TSearchRec;
begin
Result := '';
if (pos ('\\', ShortName) + pos ('*', ShortName) +
pos ('?', ShortName) <> 0) or not FileExists (ShortName)
then
{ ignore NetBIOS name, joker chars and invalid file names }
Exit;
while FindFirst (ShortName, faAnyFile, SR) = 0 do begin
{ next part as prefix }
Result := '\' + SR.Name + Result;
SysUtils.FindClose (SR); { the SysUtils, not the WinProcs procedure! }
{ directory up (cut before '\') }
ShortName := ExtractFileDir (ShortName);
if length (ShortName) <= 2 then
Break; { ShortName contains drive letter followed by ':' }
end;
Result := ExtractFileDrive (ShortName) + Result;
end;
var SR: TSearchRec;
begin
Result := '';
if (pos ('\\', ShortName) + pos ('*', ShortName) +
pos ('?', ShortName) <> 0) or not FileExists (ShortName)
then
{ ignore NetBIOS name, joker chars and invalid file names }
Exit;
while FindFirst (ShortName, faAnyFile, SR) = 0 do begin
{ next part as prefix }
Result := '\' + SR.Name + Result;
SysUtils.FindClose (SR); { the SysUtils, not the WinProcs procedure! }
{ directory up (cut before '\') }
ShortName := ExtractFileDir (ShortName);
if length (ShortName) <= 2 then
Break; { ShortName contains drive letter followed by ':' }
end;
Result := ExtractFileDrive (ShortName) + Result;
end;
0 comments :
Posting Komentar
Terima kasih atas kunjungan dan komentarnya