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 | ecd5c7ba7b94ea51f49e2a80113ae7cea08c7812 (patch) | |
tree | f5d196ef058ab115e92a8907a5f598917bb2cacb /fpicker | |
parent | a408ac9f10c885688730f20ac88d6ee8e94bcdb2 (diff) | |
parent | 197a0a0e404fa3ad20507b3e0872b00a4ff8d19e (diff) |
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 e2b4eaca35..4b3116849a 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" @@ -427,6 +428,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__); diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx index f38941f9e7..a5fd8f9551 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 56fc198650..ecc38b7e23 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; +} |