aboutsummaryrefslogtreecommitdiff
path: root/butl/path.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-30 16:36:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-30 16:36:53 +0200
commite37cf91f24fc409fa0aa84500245f57c685fc8ea (patch)
tree2c0730f6c4226b054cb5eaf640fd0bb704536dae /butl/path.ixx
parent6597c9b777b608a96974b4a7a8c15234b05ffdd8 (diff)
Implement support for Windows path actualization
Diffstat (limited to 'butl/path.ixx')
-rw-r--r--butl/path.ixx26
1 files changed, 22 insertions, 4 deletions
diff --git a/butl/path.ixx b/butl/path.ixx
index 3d1f20c..a90922a 100644
--- a/butl/path.ixx
+++ b/butl/path.ixx
@@ -3,8 +3,8 @@
// license : MIT; see accompanying LICENSE file
#ifdef _WIN32
-# include <cctype> // std::tolower
-# include <cwctype> // std::towlower
+# include <cctype> // tolower(), toupper()
+# include <cwctype> // towlower(), towupper()
#endif
namespace butl
@@ -23,6 +23,20 @@ namespace butl
{
return std::towlower (c);
}
+
+ template <>
+ inline char path_traits<char>::
+ toupper (char c)
+ {
+ return std::toupper (c);
+ }
+
+ template <>
+ inline wchar_t path_traits<wchar_t>::
+ toupper (wchar_t c)
+ {
+ return std::towupper (c);
+ }
#endif
template <class C, class K1, class K2>
@@ -223,10 +237,14 @@ namespace butl
realize ()
{
#ifdef _WIN32
+ // This is not exactly the semantics of realpath(3). In particular, we
+ // don't fail if the path does not exist. But we could have seeing that
+ // we actualize it.
+ //
complete ();
- normalize ();
+ normalize (true);
#else
- traits::realize (this->path_); // Note: we retail trailing slash.
+ traits::realize (this->path_); // Note: we retain the trailing slash.
#endif
return *this;
}