summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/winutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/windows/winutil.cpp')
-rw-r--r--src/osd/windows/winutil.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp
index 7d790949178..3a344386a12 100644
--- a/src/osd/windows/winutil.cpp
+++ b/src/osd/windows/winutil.cpp
@@ -101,7 +101,7 @@ BOOL win_is_gui_application()
//============================================================
// osd_subst_env
//============================================================
-void osd_subst_env(std::string &dst, const std::string &src)
+std::string osd_subst_env(std::string_view src)
{
std::wstring const w_src = osd::text::to_wstring(src);
std::vector<wchar_t> buffer(w_src.size() + 2);
@@ -112,10 +112,11 @@ void osd_subst_env(std::string &dst, const std::string &src)
buffer.resize(length + 1);
length = ExpandEnvironmentStringsW(w_src.c_str(), &buffer[0], buffer.size());
}
+
+ std::string dst;
if (length)
osd::text::from_wstring(dst, &buffer[0]);
- else
- dst.clear();
+ return dst;
}
//-------------------------------------------------