diff options
author | obo <obo@openoffice.org> | 2010-06-21 15:48:10 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-21 15:48:10 +0200 |
commit | 15cea5d07c629b15ed5a0c686f79a932d75e2fa4 (patch) | |
tree | ab9e54ca32177d358149c2e2fec7ae3e18e4ec78 /fpicker | |
parent | CWS-TOOLING: integrate CWS impressaccessibility7 (diff) | |
parent | merge in a warning fix (diff) | |
download | core-15cea5d07c629b15ed5a0c686f79a932d75e2fa4.tar.gz core-15cea5d07c629b15ed5a0c686f79a932d75e2fa4.zip |
CWS-TOOLING: integrate CWS vcl112
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/aqua/FilterHelper.cxx | 11 | ||||
-rw-r--r-- | fpicker/source/aqua/NSURL_OOoAdditions.hxx | 13 | ||||
-rw-r--r-- | fpicker/source/aqua/NSURL_OOoAdditions.mm | 30 |
3 files changed, 50 insertions, 4 deletions
diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 10e429f201c5..9c644326005e 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -35,6 +35,7 @@ // #endif #include "CFStringUtilities.hxx" #include "NSString_OOoAdditions.hxx" +#include "NSURL_OOoAdditions.hxx" #include "FilterHelper.hxx" @@ -428,6 +429,16 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) } } + // might be an alias + NSString* pResolved = resolveAlias( sFilename ); + if( pResolved ) + { + sal_Bool bResult = filenameMatchesFilter( pResolved ); + [pResolved autorelease]; + if( bResult ) + return sal_True; + } + DBG_PRINT_EXIT(CLASS_NAME, __func__); return sal_False; diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx index 8be2c0362096..31b55385e155 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.hxx +++ b/fpicker/source/aqua/NSURL_OOoAdditions.hxx @@ -29,15 +29,20 @@ #define _NSURL_OOOADDITIONS_HXX_ #include <premac.h> -#include <Foundation/Foundation.h> +#include <CoreFoundation/CoreFoundation.h> #include <postmac.h> #include "CFStringUtilities.hxx" #include <rtl/ustring.hxx> -// #include <sal/types.h> - @interface NSURL (OOoAdditions) - (rtl::OUString) OUStringForInfo:(InfoType)info; @end -#endif
\ No newline at end of file +/* + returns the resolved string if there was an alias + if there was no alias, nil is returned +*/ + +NSString* resolveAlias( NSString* i_pSystemPath ); + +#endif diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm index 56fc198650c8..ecc38b7e232b 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.mm +++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm @@ -80,3 +80,33 @@ return sResult; } @end + +NSString* resolveAlias( NSString* i_pSystemPath ) +{ + NSString* pResolvedPath = nil; + CFURLRef rUrl = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, + (CFStringRef)i_pSystemPath, + kCFURLPOSIXPathStyle, false); + if( rUrl != NULL ) + { + FSRef rFS; + if( CFURLGetFSRef( rUrl, &rFS ) ) + { + MacOSBoolean bIsFolder = false; + MacOSBoolean bAlias = false; + OSErr err = FSResolveAliasFile( &rFS, true, &bIsFolder, &bAlias); + if( (err == noErr) && bAlias ) + { + CFURLRef rResolvedUrl = CFURLCreateFromFSRef( kCFAllocatorDefault, &rFS ); + if( rResolvedUrl != NULL ) + { + pResolvedPath = (NSString*)CFURLCopyFileSystemPath( rResolvedUrl, kCFURLPOSIXPathStyle ); + CFRelease( rResolvedUrl ); + } + } + } + CFRelease( rUrl ); + } + + return pResolvedPath; +} |