diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-11-05 18:32:11 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-11-06 13:05:51 +0100 |
commit | 3038cdbbf3bddc49f6a58dda710a8e080dcb9ec5 (patch) | |
tree | e7c1dc3445040852935c3ebf80d137c409da5dc5 /test/headless.cpp | |
parent | 44570c1d303ea169157f82034ef3af42f73d9e8d (diff) | |
download | qtlocation-mapboxgl-3038cdbbf3bddc49f6a58dda710a8e080dcb9ec5.tar.gz |
fix various issues in curl bindings related to tile cancelation
Diffstat (limited to 'test/headless.cpp')
-rw-r--r-- | test/headless.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/headless.cpp b/test/headless.cpp index c77aa11854..d5a13031db 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -67,9 +67,14 @@ ServerEnvironment* env = nullptr; GTEST_API_ int main(int argc, char *argv[]) { // Note: glibc's dirname() **modifies** the argument and can't handle static strings. - std::string argv0 { argv[0] }; argv0 = dirname(const_cast<char *>(argv0.c_str())); std::string file { __FILE__ }; file = dirname(const_cast<char *>(file.c_str())); - base_directory = argv0 + "/" + file + "/suite/"; + if (file[0] == '/') { + // If __FILE__ is an absolute path, we don't have to guess from the argv 0. + base_directory = file + "/suite/"; + } else { + std::string argv0 { argv[0] }; argv0 = dirname(const_cast<char *>(argv0.c_str())); + base_directory = argv0 + "/" + file + "/suite/"; + } testing::InitGoogleTest(&argc, argv); env = new ServerEnvironment(); |