diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-02-02 16:56:25 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-02-02 16:56:25 +0100 |
commit | a06b295cb359d7430bd1360296bb1284ff9e003f (patch) | |
tree | 67f68f0ce6da95d4fc968a3313a238cf1ae068c9 /sal | |
parent | 447eb546507b45060107b3ea63803e1b6b0a7f38 (diff) |
#i50885# get rid of ellipses in long paths
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 35 | ||||
-rw-r--r-- | sal/osl/w32/file_url.cxx | 15 |
2 files changed, 13 insertions, 37 deletions
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 22e2c7f2d5d9..dbab4864cb28 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -668,22 +668,7 @@ static DWORD create_dir_with_callback( BOOL bCreated = FALSE; - if ( rtl_uString_getLength( dir_path ) < MAX_PATH - 12 ) - { - /* this is a normal short URL, ".." are acceptable here */ - bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL ); - } - else - { - /* the long urls can not contain ".." while calling CreateDirectory, no idea why! */ - ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH ); - sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( dir_path ) ), - aBuf, - aBuf.getBufSizeInSymbols(), - sal_False ); - - bCreated = CreateDirectoryW( aBuf, NULL ); - } + bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL ); if ( bCreated ) { @@ -783,23 +768,7 @@ oslFileError SAL_CALL osl_createDirectory(rtl_uString* strPath) { BOOL bCreated = FALSE; - if ( rtl_uString_getLength( strSysPath ) < MAX_PATH - 12 ) - { - /* this is a normal short URL, ".." are acceptable here */ - bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ); - } - else - { - /* the long urls can not contain ".." while calling CreateDirectory, no idea why! */ - ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH ); - sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( strSysPath ) ), - aBuf, - aBuf.getBufSizeInSymbols(), - sal_False ); - - bCreated = CreateDirectoryW( aBuf, NULL ); - } - + bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ); if ( !bCreated ) { diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 34bcd8169fb3..45f8c726a93e 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -779,10 +779,17 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p } else { - if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 ) + ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH ); + sal_uInt32 nNewLen = GetCaseCorrectPathName( pDecodedURL + nSkip, + aBuf, + aBuf.getBufSizeInSymbols(), + sal_False ); + + if ( nNewLen <= MAX_PATH - 12 + || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 ) || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) ) { - rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip ); + rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen ); } else if ( pDecodedURL[nSkip] == (sal_Unicode)'\\' && pDecodedURL[nSkip+1] == (sal_Unicode)'\\' ) { @@ -790,7 +797,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p rtl_uString *strSuffix = NULL; rtl_uString *strPrefix = NULL; rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 ); - rtl_uString_newFromStr_WithLength( &strSuffix, pDecodedURL + nSkip + 2, nDecodedLen - nSkip - 2 ); + rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 ); rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix ); @@ -802,7 +809,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p rtl_uString *strSuffix = NULL; rtl_uString *strPrefix = NULL; rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 ); - rtl_uString_newFromStr_WithLength( &strSuffix, pDecodedURL + nSkip, nDecodedLen - nSkip ); + rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen ); rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix ); |