aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/pathutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dutil/pathutil.cpp')
-rw-r--r--src/dutil/pathutil.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/dutil/pathutil.cpp b/src/dutil/pathutil.cpp
index ec338f71..183849ac 100644
--- a/src/dutil/pathutil.cpp
+++ b/src/dutil/pathutil.cpp
@@ -215,6 +215,39 @@ LExit:
215} 215}
216 216
217 217
218DAPI_(HRESULT) PathGetParentPath(
219 __in_z LPCWSTR wzPath,
220 __out_z LPWSTR *psczParent
221 )
222{
223 HRESULT hr = S_OK;
224 LPCWSTR wzParent = NULL;
225
226 for (LPCWSTR wz = wzPath; *wz; ++wz)
227 {
228 if (wz[1] && (L'\\' == *wz || L'/' == *wz))
229 {
230 wzParent = wz;
231 }
232 }
233
234 if (wzParent)
235 {
236 DWORD cchPath = static_cast<DWORD>(wzParent - wzPath) + 1;
237
238 hr = StrAllocString(psczParent, wzPath, cchPath);
239 PathExitOnFailure(hr, "Failed to copy directory.");
240 }
241 else
242 {
243 ReleaseNullStr(psczParent);
244 }
245
246LExit:
247 return hr;
248}
249
250
218DAPI_(HRESULT) PathExpand( 251DAPI_(HRESULT) PathExpand(
219 __out LPWSTR *psczFullPath, 252 __out LPWSTR *psczFullPath,
220 __in_z LPCWSTR wzRelativePath, 253 __in_z LPCWSTR wzRelativePath,