Skip to content

Commit

Permalink
Added support for windows paths (tangrams#2276)
Browse files Browse the repository at this point in the history
* Added support for windows paths

* Minimal changes for Windows path support
  • Loading branch information
sopyer authored and ericnelsonaz committed Aug 3, 2021
1 parent 836acba commit dd8b8cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/include/tangram/util/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Url {
// parts describes URL components by their location within the buffer.
struct Parts {
struct Range {
uint16_t start = 0, count = 0;
size_t start = 0, count = 0;
} scheme, location, path, parameters, query, fragment, media, data;
} parts;

Expand Down
5 changes: 5 additions & 0 deletions core/src/util/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cstdlib>
#include <cassert>
#include <algorithm>

namespace Tangram {

Expand Down Expand Up @@ -320,6 +321,10 @@ std::string Url::removeDotSegmentsFromString(std::string path) {
}

void Url::parse() {
#ifdef TANGRAM_WINDOWS
// Normalize Windows paths. Chromium also does this.
std::replace(buffer.begin(), buffer.end(), '\\', '/');
#endif

// The parsing process roughly follows https://tools.ietf.org/html/rfc1808#section-2.4

Expand Down

0 comments on commit dd8b8cd

Please sign in to comment.