aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-02-28 17:44:27 +0100
committerAnders Broman <a.broman58@gmail.com>2016-06-16 04:40:55 +0000
commitdabbaaf4189b88ae76870f7724c07f458c1e8b17 (patch)
treef6b72fb99398bbdad21b320fa5341bbd9de15396 /wsutil
parent897f9f7cca117b54e62c171d49ec77ac6e8b88a6 (diff)
filesystem: Fix build dir detection when using cmake
Fixes loading of plugins by detecting the build output directory of cmake. This requires a "CMakeCache.txt" file to be present in the parent directory (above run/). Change-Id: I297432cdcd0981646058410f3eadf5f73b5248c8 Reviewed-on: https://code.wireshark.org/review/7453 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/filesystem.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index b58654f664..87bf99b7ac 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -717,9 +717,23 @@ DIAG_ON(pedantic)
if (!started_with_special_privs())
running_in_build_directory_flag = TRUE;
}
+ else if (!started_with_special_privs()) {
+ /*
+ * Check for the CMake output directory. As people may name
+ * their directories "run" (really?), also check for the
+ * CMakeCache.txt file before assuming a CMake output dir.
+ */
+ if (strcmp(dir_end, "/run") == 0) {
+ gchar *cmake_file;
+ cmake_file = g_strdup_printf("%.*s/CMakeCache.txt",
+ (int)(dir_end - prog_pathname),
+ prog_pathname);
+ if (file_exists(cmake_file))
+ running_in_build_directory_flag = TRUE;
+ g_free(cmake_file);
+ }
#ifdef __APPLE__
- else {
- if (!started_with_special_privs()) {
+ if (!running_in_build_directory_flag) {
/*
* Scan up the path looking for a component
* named "Contents". If we find it, we assume
@@ -761,8 +775,8 @@ DIAG_ON(pedantic)
p--;
}
}
- }
#endif
+ }
}
/*