SRC_PATH (or source path) is a list of paths which GAUSS uses to search for files. For example, if you enter:
at the GAUSS command prompt, or you have a file that contains the line:
GAUSS will first look in your current working directory for
myprocs.src. If they are not found, GAUSS will then search the folders in the
How can I find my current SRC_PATH?
View in Library Tool
You can see which folders are in your
SRC_PATH in the Library Tool by following these steps.
- Open the Library Tool (View > Library Tool).
- Expand the Paths node and the Sources node.
The last two folders from the full path are shown. Hover your mouse over one of the paths to see all folders in the path.
Alternatively, you can use the
sysstate command to print out a semi-colon separated list of paths.
// Print the SRC_PATH folders print sysstate(22,0);
The above command will return something similar to one of the following.
C:\gauss\src;C:\gauss\examples /Users/YourUserName/gauss/src;/Users/YourUserName/gauss/examples /home/user/gauss/src;/home/user/gauss/examples
How can I modify my SRC_PATH
Add the location of your file
#includedir command will add the folder containing your program file to your source path. Consider, for example, the file named
my_main_program.gss stored in the folder
C:\Users\MyName\Research. If you add this line at the top:
C:\Users\MyName\Research will be added to the front of your
SRC_PATH. You can also add a sub-folder by adding a relative path. For example, if we modified our file to start with this:
Then GAUSS would instead add the
C:\Users\MyName\Research\src directory to your source path.
The portability of
#includedirmakes it easier for you to share code with others.
What makes this even better is that if you share this file with a colleague, it will still work without any changes regardless of the name of their main folder.
Change the SRC_PATH with the sysstate command
You can also use the
sysstate command to modify your
SRC_PATH. Instead of passing in a zero for the second argument, pass in the new
// Get the current SRC_PATH old_src_path = sysstate(22, 0); // Add a new path to the front of the SRC_PATH new_src_path = "C:\\gauss\\myproject\\src;" $+ old_src_path; // Set the new SRC_PATH call sysstate(22, new_src_path); // Print the SRC_PATH to confirm the change print sysstate(22,0);
SRC_PATH folders are searched in order, adding a new path to the front of the list means that it will be searched first (after the current working directory). This new
SRC_PATH will be in effect until it is reset or until GAUSS is restarted.
Change the SRC_PATH in gauss.cfg
When GAUSS starts up, the
SRC_PATH is initially set from the contents of the
gauss.cfg file. The
gauss.cfg file is located in the GAUSSHOME directory. The line which controls the
SRC_PATH will look something like this.
# multiple paths for program files src_path = $(GAUSSDIR)/src;$(GAUSSDIR)/examples;$(GAUSSDIR)/gaussplot/src;$(GAUSSDIR)/gaussplot/examples;$(PACKAGEDIR)/*/src;$(PACKAGEDIR)/*/examples
In the line above,
$(GAUSSDIR) means your GAUSSHOME directory. In the code below, we add the same path from our earlier
sysstate example to the front of the
# multiple paths for program files src_path = C:\gauss\myproject\src;$(GAUSSDIR)/src;$(GAUSSDIR)/examples;$(GAUSSDIR)/gaussplot/src;$(GAUSSDIR)/gaussplot/examples;$(PACKAGEDIR)/*/src;$(PACKAGEDIR)/*/examples
Since this file is read every time that GAUSS starts, this is a more permanent solution.
We have seen that:
SRC_PATHis a list of file paths that GAUSS searches when looking for files to run or open.
- The current
SRC_PATHcan be found by looking in the Library Tool, or using the
SRC_PATHcan be modified with the
sysstatecommand or by editing the