Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack Special Offer!


Share this page

Follow us
LinkedIn Blogspot Twitter Facebook

Related products
Ultimate Pack  hot!
iGrid Plotter  new!
Image Editor
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET
Print Suite .NET
Gradient Controls .NET  new!

Related links
Win32.hlp online version
MegaDetailed.NET
Delphi to C#

Special
Free Software Promotion
Offers for Resellers

Hobby projects
cdtrrracks.com
books.storrre.com
in3steps.com
sovietphillumeny.com

Get full path to the file - Files & folders - Tips & Tricks - Greatis Delphi Pages

GetLongName function allows you to get a full path to the file, using short path of this file. For example, if you have a 'C:\PROGRA~1' string, then you will get 'C:\Program Files' string.


function GetLongName(Path: string): string;

  function Check(St: string): string;
  var
    MyS: TSearchRec;
  begin
    FindFirst(St, faAnyFile, MyS);
    Result:=MyS.Name;
  end;

var
  P: Integer;
  Str, Res: string;
begin
  Res:='';
  P:=Pos('\', Path);
  Str:=Copy(Path, 1, P);
  Delete(Path, 1, P);
  Res:=Str;
  repeat
    P:=Pos('\', Path);
    if P>0 then
    begin
      Str:=Str+Copy(Path, 1, P-1);
      Delete(Path, 1, P);
      Res:=Res+Check(Str)+'\';
      Str:=Str+'\';
    end
    else
    begin
      Str:=Str+Path;
      Res:=Res+Check(Str);
    end;
  until P<=0;
  Result:=Res;
end;
Related topics
Get short path to the file

For more
Delphi Help

Download source