Revision: 23885
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23885
Author:   campbellbarton
Date:     2009-10-16 12:22:11 +0200 (Fri, 16 Oct 2009)

Log Message:
-----------
new utility function for BLI_storage.h - BLI_is_dir
currently unsupported on windows.

should fix this too [#19656] N-Panel in filebrowser not working
though typing in invalid names then becomes possible

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_storage.h
    trunk/blender/source/blender/blenlib/intern/storage.c
    trunk/blender/source/blender/editors/space_file/filesel.c

Modified: trunk/blender/source/blender/blenlib/BLI_storage.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_storage.h  2009-10-16 10:05:58 UTC 
(rev 23884)
+++ trunk/blender/source/blender/blenlib/BLI_storage.h  2009-10-16 10:22:11 UTC 
(rev 23885)
@@ -66,6 +66,9 @@
         * @param name The name of the file to read.
         * @retval A list of strings representing the file lines.
         */
+
+int BLI_is_dir(char *file);
+
 struct LinkNode *BLI_read_file_as_lines(char *name);
 
        /**

Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c       2009-10-16 
10:05:58 UTC (rev 23884)
+++ trunk/blender/source/blender/blenlib/intern/storage.c       2009-10-16 
10:22:11 UTC (rev 23885)
@@ -468,6 +468,15 @@
        return(st.st_mode);
 }
 
+/* would be better in fileops.c except that it needs stat.h so add here */
+int BLI_is_dir(char *file) {
+#ifdef WIN32
+       return 1; /* XXX - TODO */
+#else
+       return S_ISDIR(BLI_exist(file));
+#endif
+}
+
 LinkNode *BLI_read_file_as_lines(char *name)
 {
        FILE *fp= fopen(name, "r");

Modified: trunk/blender/source/blender/editors/space_file/filesel.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filesel.c   2009-10-16 
10:05:58 UTC (rev 23884)
+++ trunk/blender/source/blender/editors/space_file/filesel.c   2009-10-16 
10:22:11 UTC (rev 23885)
@@ -388,7 +388,7 @@
 {
        if (sfile->params) {
 
-               if(checkdir && S_ISDIR(BLI_exists(sfile->params->dir)) == 0) {
+               if(checkdir && BLI_is_dir(sfile->params->dir)==0) {
                        BLI_strncpy(sfile->params->dir, 
filelist_dir(sfile->files), sizeof(sfile->params->dir));
                        /* could return but just refresh the current dir */
                }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to