Board index » delphi » Little tip: Current Path property

Little tip: Current Path property

It's a very simple thing but in Delphi doesn't exist CurrPath property
so I watch the F. Manual and found this:

CurrPath:=ExtractFilePath(Param(0)); (*sorry but I'm not sure of syntax
'cause I have not source here :) *)

if you declare CurrPath into private or pubblic part of form and the
previous line into createForm event you'll have a good currPath var for
many file operation...

Bye

Uberto Barbini
ubert...@unive.it

 

Re:Little tip: Current Path property


In <311B09D7.5...@mbox.vol.it> Uberto Barbini <ca...@mbox.vol.it> writes:

Quote
>It's a very simple thing but in Delphi doesn't exist CurrPath property
>so I watch the F. Manual and found this:
>CurrPath:=ExtractFilePath(Param(0)); (*sorry but I'm not sure of syntax
>'cause I have not source here :) *)
>if you declare CurrPath into private or pubblic part of form and the
>previous line into createForm event you'll have a good currPath var for
>many file operation...

Hmm..

Param(0) should be ParamStr(0). The only problem is that ParamStr(0)
does _not_ return the current path, it returns the path where the
EXE file was started from, which is not the same thing.

Also, Application.ExeName returns the same info as ParamStr(0).

To get the current path (which could change during the course
of your program), use the GetDir procedure.

--
 Hallvard Vassbotn  | Falcon AS (a Reuters company)  | Without programmers,
 hallv...@falcon.no | Stortorget 10,0155 OSLO,Norway | the world would stop!

Other Threads