Relative Paths
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Relative Paths
Hi All,
I would like to use relative paths in my programs. The paths should be relative to the directory of the program I am running and NOT the current path as shown in the bottom right corner of the EViews window.
We are going to distribute a zip file with many programs, include files and data files in a directory structure. Programs in the programs sub-directory will include files in an include directory. They will read data from a data directory. All directory references should be relative since we won't know where users will unzip the zip file.
Within a program, am I able to obtain the directory path of the program I am running?
Thanks,
Tim
I would like to use relative paths in my programs. The paths should be relative to the directory of the program I am running and NOT the current path as shown in the bottom right corner of the EViews window.
We are going to distribute a zip file with many programs, include files and data files in a directory structure. Programs in the programs sub-directory will include files in an include directory. They will read data from a data directory. All directory references should be relative since we won't know where users will unzip the zip file.
Within a program, am I able to obtain the directory path of the program I am running?
Thanks,
Tim
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Relative Paths
Follow us on Twitter @IHSEViews
Re: Relative Paths
Gareth,
Wow. That is some documentation. Kind of makes your head spin.
There is a problem.
Using File->Open->Programs... to start a program gives results as per the documentation.
Typing run c:\filepath\prog.prg from the command window or c:\eviews8path\eviews.exe c:\filepath\prog.prg from a windows command prompt, assigns "c:\" to both the @runpath and @linepath. Also, .\..\ is relative to c:\ and is NOT referencing "above linepath".
Is this something that can be fixed in the next patch?
Thanks,
Tim
Wow. That is some documentation. Kind of makes your head spin.
There is a problem.
Using File->Open->Programs... to start a program gives results as per the documentation.
Typing run c:\filepath\prog.prg from the command window or c:\eviews8path\eviews.exe c:\filepath\prog.prg from a windows command prompt, assigns "c:\" to both the @runpath and @linepath. Also, .\..\ is relative to c:\ and is NOT referencing "above linepath".
Is this something that can be fixed in the next patch?
Thanks,
Tim
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Relative Paths
I cannot replicate that behaviour. In my testing, linepath is the path of the current running program, whether that program is run via open->program, the command line, or a dos prompt.
Follow us on Twitter @IHSEViews
Re: Relative Paths
I am running the Jul 11 2013 build.
As an example, the following test program gives different results depending on how it is initiated. Linepath is "c:\" unless initiated from via open->program.
wfcreate(wf=aaa,page="main") q 1947 2020
string runpath = @runpath
string linepath = @linepath
string datapath = @datapath
string addinspath = @addinspath
show runpath
show linepath
show datapath
show addinspath
As an example, the following test program gives different results depending on how it is initiated. Linepath is "c:\" unless initiated from via open->program.
wfcreate(wf=aaa,page="main") q 1947 2020
string runpath = @runpath
string linepath = @linepath
string datapath = @datapath
string addinspath = @addinspath
show runpath
show linepath
show datapath
show addinspath
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Relative Paths
Works fine for me.
You should update to the latest version, just in case.
You should update to the latest version, just in case.
Follow us on Twitter @IHSEViews
@linepath issues (program directory, not the file)
Hi everybody,
When I run the command @linepath inside a PRG to get a string with path/file.prg, I'm getting just the path. Any clues about why this happens (version 10 Enterprise here, Oct 17, 2019 version).
Thanks in advance,
Best, Fabio
When I run the command @linepath inside a PRG to get a string with path/file.prg, I'm getting just the path. Any clues about why this happens (version 10 Enterprise here, Oct 17, 2019 version).
Thanks in advance,
Best, Fabio
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Relative Paths
That's what it is supposed to do (Despite the documentation's example suggesting otherwise).
Follow us on Twitter @IHSEViews
Re: Relative Paths
Tks, Gareth. Is there a way to get the running program file name?
Best, F
Best, F
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Relative Paths
Tks! F
-
- EViews Developer
- Posts: 562
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Relative Paths
Hello,
There is also the undocumented command @runname that returns the file name of the "top-level" program running (ignoring the effects of include or exec as documented for @runpath).
There is also the undocumented command @runname that returns the file name of the "top-level" program running (ignoring the effects of include or exec as documented for @runpath).
Re: Relative Paths
Tks Matt. Ultra helpful. It will solve my problem!! F
Who is online
Users browsing this forum: No registered users and 14 guests