From e417e011d558693b9ff9cd048efe9cbe79da74be Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 22 Oct 2011 15:35:49 +0000 Subject: Code cleanup: file operations merged into single header, some function names made less cryptic and changed to indicate if they work on files or directories. --- source/blender/editors/interface/interface_icons.c | 9 ++++----- source/blender/editors/space_buttons/buttons_ops.c | 1 - source/blender/editors/space_file/file_draw.c | 1 - source/blender/editors/space_file/file_ops.c | 5 ++--- source/blender/editors/space_file/filelist.c | 5 ++--- source/blender/editors/space_file/filesel.c | 1 - source/blender/editors/space_file/space_file.c | 1 - source/blender/editors/space_image/image_ops.c | 4 ++-- source/blender/editors/space_node/node_edit.c | 5 ----- source/blender/editors/space_sequencer/sequencer_add.c | 1 - source/blender/editors/space_sequencer/sequencer_edit.c | 3 +-- 11 files changed, 11 insertions(+), 25 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c1418c5b6e8..f987aa9c4e6 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -47,7 +47,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "DNA_brush_types.h" @@ -609,11 +608,11 @@ static void init_iconfile_list(struct ListBase *list) if(icondir==NULL) return; - /* since BLI_getdir changes the current working directory, restore it + /* since BLI_dir_contents changes the current working directory, restore it back to old value afterwards */ - if(!BLI_getwdN(olddir, sizeof(olddir))) + if(!BLI_current_working_dir(olddir, sizeof(olddir))) restoredir = 0; - totfile = BLI_getdir(icondir, &dir); + totfile = BLI_dir_contents(icondir, &dir); if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */ for(i=0; i=0; i--){ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 3cf4de992e5..5dbcfbba5be 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -39,7 +39,6 @@ #include "BLI_fileops.h" #include "BLI_path_util.h" -#include "BLI_storage.h" #include "BLI_string.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 6fbfa11d0cf..8a7e4ce3ec1 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -37,7 +37,6 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" #include "BLI_dynstr.h" -#include "BLI_storage_types.h" #ifdef WIN32 #include "BLI_winstuff.h" #endif diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 7a379b93ee6..079b1c96d24 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -39,7 +39,6 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLI_storage_types.h" #ifdef WIN32 #include "BLI_winstuff.h" #endif @@ -1042,7 +1041,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op) } /* create the file */ - BLI_recurdir_fileops(path); + BLI_dir_create_recursive(path); if (!BLI_exists(path)) { BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder"); @@ -1136,7 +1135,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) file_expand_directory(C); if (!BLI_exists(sfile->params->dir)) { - BLI_recurdir_fileops(sfile->params->dir); + BLI_dir_create_recursive(sfile->params->dir); } /* special case, user may have pasted a fulepath into the directory */ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index b478976d027..89a34c62200 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -48,7 +48,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" -#include "BLI_storage_types.h" #include "BLI_threads.h" #include "BLI_utildefines.h" @@ -825,10 +824,10 @@ static void filelist_read_dir(struct FileList* filelist) filelist->fidx = NULL; filelist->filelist = NULL; - BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */ + BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */ BLI_cleanup_dir(G.main->name, filelist->dir); - filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); + filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) {} /* fix warning about not checking return value */ filelist_setfiletypes(filelist); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 790e2f573ee..29d8242e26d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -64,7 +64,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" -#include "BLI_storage_types.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 7a70ed9c0a0..726a2a80be1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -46,7 +46,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 725b5f5c02d..dba60586b29 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -143,7 +143,7 @@ static int space_image_file_exists_poll(bContext *C) if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); BLI_path_abs(name, bmain->name); - poll= (BLI_exists(name) && BLI_is_writable(name)); + poll= (BLI_exists(name) && BLI_file_is_writable(name)); } ED_space_image_release_buffer(sima, lock); @@ -1223,7 +1223,7 @@ static int save_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; save_image_options_from_op(&simopts, op); - if (BLI_exists(simopts.filepath) && BLI_is_writable(simopts.filepath)) { + if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) { save_image_doit(C, sima, op, &simopts, FALSE); } else { diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 5ca9a6f12fb..59e62c9b0e4 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -49,7 +49,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -66,10 +65,6 @@ #include "BKE_texture.h" #include "BKE_report.h" - -#include "BLI_math.h" -#include "BLI_storage_types.h" - #include "RE_pipeline.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 2b78bc3c190..2f57bc2d93b 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "DNA_scene_types.h" diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 33d2a27f789..a20ab260379 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -45,7 +45,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BLI_threads.h" @@ -883,7 +882,7 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) if(seq->type==SEQ_MOVIE) { if(seq->strip && seq->strip->stripdata) { BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); - BLI_touch(seq->name); + BLI_file_touch(seq->name); } } -- cgit v1.2.3