From 064db3fcf223c4a201db5c75b67070681b4aa289 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 13 Aug 2015 09:11:24 -0700 Subject: [PATCH] sky_snapshot should work with absolute paths Instead of appending the first path component, we should use it to initialize `result`. That makes this code work with absolute paths. --- engine/src/flutter/sky/tools/sky_snapshot/loader.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/sky/tools/sky_snapshot/loader.cc b/engine/src/flutter/sky/tools/sky_snapshot/loader.cc index bac6edb9dce..c91f756fdca 100644 --- a/engine/src/flutter/sky/tools/sky_snapshot/loader.cc +++ b/engine/src/flutter/sky/tools/sky_snapshot/loader.cc @@ -25,8 +25,10 @@ std::string Fetch(const std::string& url) { base::FilePath SimplifyPath(const base::FilePath& path) { std::vector components; path.GetComponents(&components); - base::FilePath result; - for (const auto& component : components) { + auto it = components.begin(); + base::FilePath result(*it++); + for (; it != components.end(); it++) { + auto& component = *it; if (component == base::FilePath::kCurrentDirectory) continue; if (component == base::FilePath::kParentDirectory)