aboutsummaryrefslogtreecommitdiff
path: root/butl/process.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-30 11:47:27 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-12-05 14:04:01 +0300
commite7b033d7b38bc55f934521b5f35060b43a8b0526 (patch)
tree52a99420086e7e86ac99ef4b2b96bd210504cf01 /butl/process.cxx
parentcf8f3b830789a6bcc538d2f4d0e8a1425a110c47 (diff)
Make path::normalize() to preserve ./, invalidate paths starting with \, / on Windows
Diffstat (limited to 'butl/process.cxx')
-rw-r--r--butl/process.cxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/butl/process.cxx b/butl/process.cxx
index c75cfbd..cf4b26d 100644
--- a/butl/process.cxx
+++ b/butl/process.cxx
@@ -171,7 +171,7 @@ namespace butl
ep = path (move (s)); // Move back into result.
if (norm)
- ep.normalize (); //@@ NORM
+ ep.normalize ();
return exists (ep.string ().c_str ());
};
@@ -212,10 +212,17 @@ namespace butl
e = strchr (b, traits::path_separator);
// Empty path (i.e., a double colon or a colon at the beginning or end
- // of PATH) means search in the current dirrectory.
+ // of PATH) means search in the current dirrectory. Silently skip
+ // invalid paths.
//
- if (search (b, e != nullptr ? e - b : strlen (b)))
- return r;
+ try
+ {
+ if (search (b, e != nullptr ? e - b : strlen (b)))
+ return r;
+ }
+ catch (const invalid_path&)
+ {
+ }
}
// If we were given a fallback, try that.
@@ -575,10 +582,17 @@ namespace butl
e = strchr (b, traits::path_separator);
// Empty path (i.e., a double colon or a colon at the beginning or end
- // of PATH) means search in the current dirrectory.
+ // of PATH) means search in the current dirrectory. Silently skip
+ // invalid paths.
//
- if (search (b, e != nullptr ? e - b : strlen (b)))
- return r;
+ try
+ {
+ if (search (b, e != nullptr ? e - b : strlen (b)))
+ return r;
+ }
+ catch (const invalid_path&)
+ {
+ }
}
// Finally, if we were given a fallback, try that. This case is similar to