Merging r41246 through r41535 from trunk into soc-2011-tomato
[blender.git] / source / blender / blenkernel / intern / blender.c
index dc0580bce969ea6285afb1482f3398b8400c71e1..d68b0b361d1db13d3449b2543320825997f0290c 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -59,7 +57,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_bpath.h"
 #include "BLI_dynstr.h"
-#include "BLI_path_util.h"
 #include "BLI_utildefines.h"
 #include "BLI_callbacks.h"
 
@@ -163,22 +160,19 @@ static void clear_global(void)
        G.main= NULL;
 }
 
+static int clean_paths_visit_cb(void *UNUSED(userdata), char *path_dst, const char *path_src)
+{
+       strcpy(path_dst, path_src);
+       BLI_clean(path_dst);
+       return (strcmp(path_dst, path_src) == 0) ? FALSE : TRUE;
+}
+
 /* make sure path names are correct for OS */
 static void clean_paths(Main *main)
 {
-       struct BPathIterator *bpi;
-       char filepath_expanded[1024];
        Scene *scene;
 
-       for(BLI_bpathIterator_init(&bpi, main, main->name, BPATH_USE_PACKED); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
-               BLI_bpathIterator_getPath(bpi, filepath_expanded);
-
-               BLI_clean(filepath_expanded);
-
-               BLI_bpathIterator_setPath(bpi, filepath_expanded);
-       }
-
-       BLI_bpathIterator_free(bpi);
+       bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
 
        for(scene= main->scene.first; scene; scene= scene->id.next) {
                BLI_clean(scene->r.pic);
@@ -551,7 +545,7 @@ void BKE_write_undo(bContext *C, const char *name)
                counter= counter % U.undosteps; 
        
                BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
-               BLI_make_file_string("/", filepath, btempdir, numstr);
+               BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr);
        
                /* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
                
@@ -721,7 +715,7 @@ void BKE_undo_save_quit(void)
        /* no undo state to save */
        if(undobase.first==undobase.last) return;
                
-       BLI_make_file_string("/", str, btempdir, "quit.blend");
+       BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
 
        file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
        if(file == -1) {