From 3af0a8cc829c93baa4e8b9785f401f1da700f17a Mon Sep 17 00:00:00 2001 From: Thorsten Engel Date: Mon, 27 Mar 2006 09:33:13 +0000 Subject: [PATCH] bugfix for c:/ or c:\\ (didn't work correctly on win32 if root dir was given) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2864 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/win32/compat/compat.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 70e6e53efa..0b864b198d 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -70,7 +70,8 @@ void conv_unix_to_win32_path(const char *name, char *win32_name, DWORD dwSize) name++; } /* Strip any trailing slash, if we stored something */ - if (*fname != 0 && win32_name[-1] == '\\') { + /* but leave "c:\" with backslash (root directory case */ + if (*fname != 0 && win32_name[-1] == '\\' && strlen (fname) != 3) { win32_name[-1] = 0; } else { *win32_name = 0; @@ -134,7 +135,7 @@ make_wchar_win32_path(POOLMEM* pszUCSPath, BOOL* pBIsRawPath /*= NULL*/) BOOL bAddPrefix = TRUE; /* does path begin with drive? if yes, it is absolute */ - if (wcslen(name) > 3 && (iswalpha (*name) && *(name+1) == ':' + if (wcslen(name) >= 3 && (iswalpha (*name) && *(name+1) == ':' && (*(name+2) == '\\' || *(name+2) == '/'))) { bAddDrive = FALSE; bAddCurrentPath = FALSE; @@ -873,7 +874,12 @@ opendir(const char *path) conv_unix_to_win32_path(path, tspec, max_len); } - bstrncat(tspec, "\\*", max_len); + // add backslash only if there is none yet (think of c:\) + if (tspec[strlen(tspec)-1] != '\\') + bstrncat(tspec, "\\*", max_len); + else + bstrncat(tspec, "*", max_len); + rval->spec = tspec; // convert to WCHAR -- 2.39.5