Dosen adalah pendidik profesional dan ilmuwan dengan tugas utama mentransformasikan, mengembangkan, dan menyebarluaskan ilmu pengetahuan, teknologi melalui pendidikan, penelitian, dan pengabdian kepada masyarakat (Permendikbud 49/2014 Pasal 1:14)

09 Juli 2008

Get the long file name from a shortened (8 + 3) file name

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;

0 komentar :

Posting Komentar

Terima kasih atas kunjungan dan komentarnya