Changeset 5064

Show
Ignore:
Timestamp:
12/03/07 19:07:45 (8 months ago)
Author:
morris
Message:

Handle decomposed file name strings so that we can compare them when searching

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wired/trunk/wired/files.c

    r5047 r5064  
    2929#include "config.h" 
    3030 
     31#ifdef HAVE_CORESERVICES_CORESERVICES_H 
     32#import <CoreFoundation/CoreFoundation.h> 
     33#endif 
     34 
    3135#include <sys/param.h> 
    3236#include <sys/stat.h> 
     
    631635                /* get file type */ 
    632636                type = wd_files_type_with_stat(filepath, &sb); 
    633                 name = wi_string_with_cstring(p->fts_name); 
     637                name = wd_files_path_with_decomposed_cstring(p->fts_name); 
    634638                 
    635639                if(wi_string_contains_string(name, query, WI_STRING_CASE_INSENSITIVE)) { 
     
    874878        WI_FTS                                  *fts = NULL; 
    875879        WI_FTSENT                               *p; 
    876         wi_string_t                             *filepath, *virtualpath, *string; 
     880        wi_string_t                             *filepath, *virtualpath, *name, *string; 
    877881        wi_number_t                             *number; 
    878882        wi_file_offset_t                size; 
     
    954958                /* get file type & size */ 
    955959                type = wd_files_type_with_stat(filepath, &sb); 
     960                name = wd_files_path_with_decomposed_cstring(p->fts_name); 
    956961 
    957962                switch(type) { 
     
    975980                 
    976981                wi_file_write(file, WI_STR("%#s%c%#s%#@%c%u%c%llu%c%#@%c%#@\n"), 
    977                                           p->fts_name,                        WD_FIELD_SEPARATOR, 
     982                                          name,                                       WD_FIELD_SEPARATOR, 
    978983                                          pathprefix, 
    979984                                          virtualpath,                  WD_FIELD_SEPARATOR, 
     
    13201325 
    13211326 
     1327wi_string_t * wd_files_path_with_decomposed_cstring(const char *cstring) { 
     1328        wi_string_t                             *path; 
     1329         
     1330#ifdef HAVE_CORESERVICES_CORESERVICES_H 
     1331        CFMutableStringRef              string; 
     1332        char                                    buffer[WI_PATH_SIZE]; 
     1333         
     1334        string = CFStringCreateMutable(NULL, 0); 
     1335        CFStringAppendCString(string, cstring, kCFStringEncodingUTF8); 
     1336        CFStringNormalize(string, kCFStringNormalizationFormC); 
     1337        CFStringGetCString(string, buffer, sizeof(buffer), kCFStringEncodingUTF8); 
     1338        path = wi_string_with_cstring(buffer); 
     1339        CFRelease(string); 
     1340#else 
     1341        path = wi_string_with_cstring(cstring); 
     1342#endif 
     1343         
     1344        return path; 
     1345} 
     1346 
     1347 
     1348 
    13221349#pragma mark - 
    13231350 
  • wired/trunk/wired/files.h

    r4508 r5064  
    7373wi_boolean_t                                                    wd_files_path_is_dropbox(wi_string_t *); 
    7474wi_string_t *                                                   wd_files_real_path(wi_string_t *); 
     75wi_string_t *                                                   wd_files_path_with_decomposed_cstring(const char *); 
    7576 
    7677