diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 6184425885e..b4b1145f429 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -570,10 +570,13 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate BLI_strncpy(bookmark, fname, FILE_MAX); sl = strlen(bookmark)-1; - while (bookmark[sl] == '\\' || bookmark[sl] == '/') { - bookmark[sl] = '\0'; - sl--; + if (sl > 1) { + while (bookmark[sl] == '\\' || bookmark[sl] == '/') { + bookmark[sl] = '\0'; + sl--; + } } + if (fsmenu_is_selected(fsmenu, category, i) ) { UI_ThemeColor(TH_HILITE); //uiSetRoundBox(15); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 6ef946c9697..59e8dcf82e6 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -47,6 +47,12 @@ #include "BLI_winstuff.h" #endif +#ifdef __APPLE__ +#include + +#include "BKE_utildefines.h" +#endif + #include "fsmenu.h" /* include ourselves */ @@ -303,6 +309,27 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename) } #endif +#ifdef __APPLE__ + { + OSErr err=noErr; + int i; + + /* loop through all the OS X Volumes, and add them to the SYSTEM section */ + for (i=1; err!=nsvErr; i++) + { + FSRef dir; + unsigned char path[FILE_MAXDIR+FILE_MAXFILE]; + + err = FSGetVolumeInfo(kFSInvalidVolumeRefNum, i, NULL, kFSVolInfoNone, NULL, NULL, &dir); + if (err != noErr) + continue; + + FSRefMakePath(&dir, path, FILE_MAXDIR+FILE_MAXFILE); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, 1, 0); + } + } +#endif + fp = fopen(filename, "r"); if (!fp) return;