diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-09-01 02:35:46 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-09-01 02:35:46 +0000 |
commit | da2d6c8d7706cc53461fb6178b8c66eb941b2a85 (patch) | |
tree | 1a6b348aefb1b6afe9d5692397da930b4308c2ca /epan/filesystem.c | |
parent | 187919723fe68164b464f71cfacd8e228ff8848d (diff) |
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
Diffstat (limited to 'epan/filesystem.c')
-rw-r--r-- | epan/filesystem.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/epan/filesystem.c b/epan/filesystem.c index 7ce3786eaf..c0c844f8bf 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -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 { |