wiki:EditPath

Version 4 (modified by Gary J. Ferland, 13 years ago) (diff)

--

Setting the path


Setting the path by editing path.cpp

There are vast amounts of atomic data that the code must reference in order to compute a model. These are the files that live in the data directory. The code must be able to find these data files. Their location is stored in a global string variable named chDataPath which is set in the file path.cpp. You need to change the string so that it gives the location of the data on your machine.

Edit the file path.cpp (located in the source directory) and locate the variable chDataPath. Change the string within the double quotes so that it gives the location of the data. Remember that this is C++ code and that a line ends with a semicolon.

In Unix the path would be a string within double quotes as in

/* sample path on a Unix box */
char chDataPath[DATA_PATH_LENGTH]="/usr/gary/cloudy/data/";

On a Windows machine the path would be a string within double quotes as in

/* sample path on a windows box */
char chDataPath[DATA_PATH_LENGTH]="c:\\projects\\cloudy\\current\\data\\";

The double backslash is needed on Windows systems to prevent the character following the slash from being interpreted as an escape sequence.

The string giving the path MUST have the proper directory mark as the last character before the second quote. This would be a "/" in Unix, a "
" in Windows, and a "]" in VMS. The entire line must end in a semicolon because this is C.

If the path is longer than FILENAME_PATH_LENGTH characters then increase the size of FILENAME_PATH_LENGTH in cddefines.h and recompile the entire code. Remember that in C a string must have one extra byte for storing the end-of-string sentinel.

If you store your *.ini initialization files in the data directory then the ini files will be automatically found by the code.


Setting the path with compiler macro options

Robin Williams added a macro, LOCAL_DATA_PATH, that allows the path to be specified by the value of the macro. See the compiler documentation for instructions on command line macro options (usually "-D").


Next step: CompileCode - compile the code.

Return to StepByStep instructions

Return to nublado.org