If we're running from the build directory, check the WIRESHARK_SRC_DIR

environment variable, and, if it's set, use it rather than the build
directory as the data file directory.  This is to handle
out-of-source-tree builds.

svn path=/trunk/; revision=38832
This commit is contained in:
Guy Harris 2011-09-01 02:35:46 +00:00
parent 187919723f
commit da2d6c8d77
1 changed files with 25 additions and 1 deletions

View File

@ -622,12 +622,36 @@ get_datafile_dir(void)
}
}
#else
if (running_in_build_directory_flag) {
/*
* We're (probably) being run from the build directory and
* weren't started with special privileges.
*
* The data files we want are the ones from the source
* directory; to handle builds out of the source tree,
* we check whether WIRESHARK_SRC_DIR is set and, if so,
* use that as the source directory.
*/
datafile_dir = getenv("WIRESHARK_SRC_DIR");
if (datafile_dir != NULL)
return datafile_dir;
}
/*
* Well, that didn't work.
* Check again whether we were (probably) run from the build
* directory and started without special privileges, and also
* check whether we were able to determine the directory in
* which the program was found.
*/
if (running_in_build_directory_flag && progfile_dir != NULL) {
/*
* We're (probably) being run from the build directory and
* weren't started with special privileges, and we were
* able to determine the directory in which the program
* was found, so use that.
* was found. Assume that directory is the build
* directory and that it's the same as the source
* directory.
*/
datafile_dir = progfile_dir;
} else {