File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
libaegisub/include/libaegisub Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ class path : public std::filesystem::path {
5454 return std::string (reinterpret_cast <const char *>(result.c_str ()), result.size ());
5555 }
5656
57+ inline std::string generic_string () const {
58+ const auto result = std::filesystem::path::generic_u8string ();
59+ return std::string (reinterpret_cast <const char *>(result.c_str ()), result.size ());
60+ }
61+
5762 // We do not override wstring() here: While the conversion method for this is technically unspecified here,
5863 // it seems to always return UTF-16 in practice. If this ever changes, wstring() can be overwritten or deleted here.
5964
@@ -63,6 +68,15 @@ class path : public std::filesystem::path {
6368 return path (lhs_ / rhs_);
6469 }
6570
71+ // This will only work if C is char, but for other calls we will get a compiler error, which
72+ // is what we want. If operator<< for wostreams is ever needed, the compiler will complain and
73+ // an implementation can be added.
74+ template <typename C, typename T>
75+ inline friend std::basic_ostream<C, T>& operator <<(std::basic_ostream<C, T> &ostr, path const & rhs) {
76+ ostr << std::quoted (rhs.string ());
77+ return ostr;
78+ }
79+
6680#define WRAP_SFP (name ) \
6781 inline path name () const { \
6882 return path (std::filesystem::path::name ()); \
You can’t perform that action at this time.
0 commit comments