diff options
author | Jens Verwiebe <info@jensverwiebe.de> | 2012-11-03 00:26:37 +0400 |
---|---|---|
committer | Jens Verwiebe <info@jensverwiebe.de> | 2012-11-03 00:26:37 +0400 |
commit | 1930a51f092fdc562616cd15be71170c62b0fb50 (patch) | |
tree | 552441e6520c7c91afdb044414a3ff4b1cc32a00 /source/blender/editors/space_file/fsmenu.c | |
parent | c9307ec6a3d1dd74e7e417634358e15d6c1022e2 (diff) |
OSX: a more friendly way to get mounted volumes, alo allows for whitespaces etc.
Diffstat (limited to 'source/blender/editors/space_file/fsmenu.c')
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index a5647c06b92..d3761448a81 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -425,14 +425,23 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (err != noErr) continue; - pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle); + /* Get mounted volumes better method see: */ + /*https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html*/ - if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII)) - continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, FS_INSERT_SORTED); + CFURLEnumeratorResult result = kCFURLEnumeratorSuccess; + CFURLEnumeratorRef volEnum = CFURLEnumeratorCreateForMountedVolumes(NULL, kCFURLEnumeratorSkipInvisibles, NULL); - CFRelease(pathString); - CFRelease(cfURL); + while (result != kCFURLEnumeratorEnd) { + unsigned char defPath[FILE_MAX]; + + result = CFURLEnumeratorGetNextURL(volEnum, &cfURL, NULL); + if (result != kCFURLEnumeratorSuccess) + continue; + + CFURLGetFileSystemRepresentation(cfURL, false, (UInt8*)defPath, FILE_MAX); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)defPath, FS_INSERT_SORTED); + } + CFRelease(volEnum); } CFRelease(pathesArray); |