summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/longfilepathwrappers.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/utilcode/longfilepathwrappers.cpp b/src/utilcode/longfilepathwrappers.cpp
index 2cce3b5272..2b5a8b48a6 100644
--- a/src/utilcode/longfilepathwrappers.cpp
+++ b/src/utilcode/longfilepathwrappers.cpp
@@ -1230,12 +1230,15 @@ BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer)
BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer)
{
- BOOL retval;
- COUNT_T size = MAX_LONGPATH; //Retry once the PAL Api is fixed to return the correct size
- WCHAR* buffer = pbuffer.OpenUnicodeBuffer(size - 1);
+ BOOL retval = FALSE;
+ COUNT_T size = MAX_LONGPATH;
+
+ if(!(retval = PAL_GetPALDirectoryW(pbuffer.OpenUnicodeBuffer(size - 1), &size)))
+ {
+ pbuffer.CloseBuffer(0);
+ retval = PAL_GetPALDirectoryW(pbuffer.OpenUnicodeBuffer(size - 1), &size);
+ }
- retval = PAL_GetPALDirectoryW(pbuffer.OpenUnicodeBuffer(size - 1), size);
- size = (COUNT_T)wcslen(buffer);
pbuffer.CloseBuffer(size);
return retval;