[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20026] branches/blender2.5/blender/source /blender/editors/space_file: * Added a list of OS X volumes to the file selector bookmarks pane, consistent with the drive letters on Windows.

Matt Ebb matt at mke3.net
Sat May 2 05:09:40 CEST 2009


Revision: 20026
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20026
Author:   broken
Date:     2009-05-02 05:09:40 +0200 (Sat, 02 May 2009)

Log Message:
-----------
* Added a list of OS X volumes to the file selector bookmarks pane, consistent with the drive letters on Windows. Currently this list only gets refreshed on Blender startup, hopefully this can be worked on but for now at least it's better than having to manually navigate to /Volumes/...

http://mke3.net/blender/devel/2.5/fileselect_volumes.png

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
    branches/blender2.5/blender/source/blender/editors/space_file/fsmenu.c

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c	2009-05-02 02:40:11 UTC (rev 20025)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c	2009-05-02 03:09:40 UTC (rev 20026)
@@ -570,10 +570,13 @@
 			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);	

Modified: branches/blender2.5/blender/source/blender/editors/space_file/fsmenu.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/fsmenu.c	2009-05-02 02:40:11 UTC (rev 20025)
+++ branches/blender2.5/blender/source/blender/editors/space_file/fsmenu.c	2009-05-02 03:09:40 UTC (rev 20026)
@@ -47,6 +47,12 @@
 #include "BLI_winstuff.h"
 #endif
 
+#ifdef __APPLE__
+#include <CoreServices/CoreServices.h>
+
+#include "BKE_utildefines.h"
+#endif
+
 #include "fsmenu.h"  /* include ourselves */
 
 
@@ -303,6 +309,27 @@
 	}
 #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;
 





More information about the Bf-blender-cvs mailing list