SRC_PATH

Introduction

The SRC_PATH is a list of paths which GAUSS uses to search for files. For example, if you enter:

run myfile.gss;

at the GAUSS command prompt, or you have a file which contains the line:

#include myprocs.src;

GAUSS will first look in your current working directory for myfile.gss or myprocs.src. If they are not found, GAUSS will then search the folders in the SRC_PATH.

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.

  1. Open the Library Tool (View > Library Tool).
  2. Expand the Paths node and the Sources node.

The GAUSS Source Paths.

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

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 SRC_PATH.

// 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);

Since the 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 SRC_PATH.

# 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.

Conclusions

We have seen that:

  • The SRC_PATH is a list of file paths that GAUSS searches when looking for files to run or open.
  • The current SRC_PATH can be found by looking in the Library Tool, or using the sysstate command.
  • The SRC_PATH can be modified with the sysstate command or by editing the gauss.cfg file.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

REQUEST A FREE QUOTE

Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap