diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-08-27 14:28:56 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-08-27 14:28:56 +0200 |
commit | 953e5524a99325ffb049f466b85ce13a62dc327a (patch) | |
tree | 36e1db7f68c94f1ad0135eed0dd1b3292c4a4ca3 /test/fixtures/fixture_request.cpp | |
parent | a55be0217bdc2b4e15500f9a5cd4aba207d33fc7 (diff) | |
download | qtlocation-mapboxgl-953e5524a99325ffb049f466b85ce13a62dc327a.tar.gz |
fix basepath for headless stylesheets
Diffstat (limited to 'test/fixtures/fixture_request.cpp')
-rw-r--r-- | test/fixtures/fixture_request.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp index 1a7ed2ccc3..7e351ecfac 100644 --- a/test/fixtures/fixture_request.cpp +++ b/test/fixtures/fixture_request.cpp @@ -1,12 +1,15 @@ #include <mbgl/platform/platform.hpp> #include <mbgl/platform/request.hpp> #include <mbgl/util/uv_detail.hpp> +#include <mbgl/util/url.hpp> #include <mbgl/platform/log.hpp> const std::string base_directory = []{ std::string fn = __FILE__; fn.erase(fn.find_last_of("/")); - return fn; + fn.erase(fn.find_last_of("/")); + fn.erase(fn.find_last_of("/")); + return fn + "/node_modules/mapbox-gl-test-suite/"; }(); @@ -23,14 +26,11 @@ platform::request_http(const std::string &url, l = uv_default_loop(); } - std::string clean_url = base_directory + "/" + url; - auto pos = clean_url.find("://"); - if (pos != std::string::npos) { - clean_url.replace(pos, 3, "/"); + std::string clean_url = util::percentDecode(url); + if (clean_url.find("local://") == 0) { + clean_url = base_directory + clean_url.substr(8); } - std::replace(clean_url.begin(), clean_url.end(), '+', ' '); - std::shared_ptr<Request> req = std::make_shared<Request>(url, callback, loop); int err; |