Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-10-22 19:35:49 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-10-22 19:35:49 +0400
commite417e011d558693b9ff9cd048efe9cbe79da74be (patch)
tree36612e30bf5c561051635c8eef7180d29251e846 /source
parentc1de5cc83829b65094eee024af10928bd13261ce (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_translation.c2
-rw-r--r--source/blender/blenkernel/intern/effect.c1
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c1
-rw-r--r--source/blender/blenkernel/intern/packedFile.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c3
-rw-r--r--source/blender/blenkernel/intern/sequencer.c1
-rw-r--r--source/blender/blenlib/BLI_blenlib.h2
-rw-r--r--source/blender/blenlib/BLI_edgehash.h2
-rw-r--r--source/blender/blenlib/BLI_fileops.h58
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h (renamed from source/blender/blenlib/BLI_storage_types.h)9
-rw-r--r--source/blender/blenlib/BLI_mempool.h2
-rw-r--r--source/blender/blenlib/BLI_scanfill.h2
-rw-r--r--source/blender/blenlib/BLI_storage.h71
-rw-r--r--source/blender/blenlib/CMakeLists.txt3
-rw-r--r--source/blender/blenlib/intern/fileops.c47
-rw-r--r--source/blender/blenlib/intern/path_util.c12
-rw-r--r--source/blender/blenlib/intern/storage.c31
-rw-r--r--source/blender/blenloader/intern/readblenentry.c8
-rw-r--r--source/blender/blenloader/intern/runtime.c2
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/collada/ImageExporter.cpp2
-rw-r--r--source/blender/collada/collada.cpp5
-rw-r--r--source/blender/editors/interface/interface_icons.c9
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c1
-rw-r--r--source/blender/editors/space_file/file_draw.c1
-rw-r--r--source/blender/editors/space_file/file_ops.c5
-rw-r--r--source/blender/editors/space_file/filelist.c5
-rw-r--r--source/blender/editors/space_file/filesel.c1
-rw-r--r--source/blender/editors/space_file/space_file.c1
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_node/node_edit.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c3
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp2
-rw-r--r--source/blender/imbuf/intern/readimage.c4
-rw-r--r--source/blender/imbuf/intern/thumbs.c6
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c6
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
39 files changed, 138 insertions, 192 deletions
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 90d9c4a5981..17290c66544 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -60,7 +60,7 @@ unsigned char *BLF_get_unifont(int *unifont_size_r)
BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
- unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size);
+ unifont_ttf= (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
}
else {
printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index f728916a158..e3e769253f1 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -33,7 +33,6 @@
#include <stddef.h>
-#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
#include <math.h>
#include <stdlib.h>
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 1c2f1c8487c..9247646b927 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -33,7 +33,6 @@
#include <stddef.h>
-#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 0041cd33c14..70b0b7727c4 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -192,7 +192,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
if (file <= 0) {
BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
} else {
- filelen = BLI_filesize(file);
+ filelen = BLI_file_descriptor_size(file);
if (filelen == 0) {
// MEM_mallocN complains about MEM_mallocN(0, "bla");
@@ -283,7 +283,7 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
for (number = 1; number <= 999; number++) {
BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number);
if (! BLI_exists(tempname)) {
- if (BLI_copy_fileops(name, tempname) == RET_OK) {
+ if (BLI_copy(name, tempname) == RET_OK) {
remove_tmp = TRUE;
}
break;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c642f76d400..cebefe81495 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -36,7 +36,6 @@
#include <stddef.h>
-#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
#include <stdlib.h>
#include <math.h>
@@ -64,7 +63,7 @@
#include "BLI_rand.h"
#include "BLI_jitter.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h" /* BLI_storage.h For _LARGEFILE64_SOURCE; zlib needs this on some systems */
+#include "BLI_blenlib.h"
#include "BLI_kdtree.h"
#include "BLI_kdopbvh.h"
#include "BLI_threads.h"
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index e0e61a71dc2..cf03a8d3f36 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -51,7 +51,6 @@
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
-#include "BLI_storage.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index a5c0e03c09e..356709d5ccd 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -76,8 +76,6 @@ extern "C" {
#include "BLI_path_util.h"
-#include "BLI_storage.h"
-
#include "BLI_fileops.h"
#include "BLI_rect.h"
diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h
index fba13035f02..23ffdbae59b 100644
--- a/source/blender/blenlib/BLI_edgehash.h
+++ b/source/blender/blenlib/BLI_edgehash.h
@@ -30,7 +30,7 @@
#ifndef BLI_EDGEHASH_H
#define BLI_EDGEHASH_H
-/** \file BLI_storage.h
+/** \file BLI_edgehash.h
* \ingroup bli
* \author Daniel Dunbar
* \brief A general unordered 2-int pair hash table ADT.
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 354931e306a..ebe231e2973 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -29,10 +29,7 @@
/** \file BLI_fileops.h
* \ingroup bli
- * \author Daniel Dunbar
- * \brief More low-level fileops from Daniel Dunbar. Two functions were also
- * defined in storage.c. These are the old fop_ prefixes. There is
- * definitely some redundancy here!
+ * \brief File and directory operations.
* */
#ifndef BLI_FILEOPS_H
@@ -42,17 +39,48 @@
extern "C" {
#endif
-void BLI_recurdir_fileops(const char *dirname);
-int BLI_link(const char *file, const char *to);
-int BLI_is_writable(const char *filename);
-
-int BLI_copy_fileops(const char *file, const char *to);
-int BLI_rename(const char *from, const char *to);
-int BLI_gzip(const char *from, const char *to);
-char *BLI_ungzip_to_mem(const char *from_file, int *size_r);
-int BLI_delete(const char *file, int dir, int recursive);
-int BLI_move(const char *file, const char *to);
-int BLI_touch(const char *file);
+#include "BLI_fileops_types.h"
+
+/* for size_t (needed on windows) */
+#include <stddef.h>
+
+/* Common */
+
+int BLI_exists(const char *path);
+int BLI_copy(const char *path, const char *to);
+int BLI_rename(const char *from, const char *to);
+int BLI_delete(const char *path, int dir, int recursive);
+int BLI_move(const char *path, const char *to);
+int BLI_create_symlink(const char *path, const char *to);
+
+/* Directories */
+
+struct direntry;
+
+int BLI_is_dir(const char *path);
+void BLI_dir_create_recursive(const char *dir);
+double BLI_dir_free_space(const char *dir);
+char *BLI_current_working_dir(char *dir, const int maxlen);
+
+unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist);
+
+/* Files */
+
+int BLI_file_is_writable(const char *file);
+int BLI_file_touch(const char *file);
+
+int BLI_file_gzip(const char *from, const char *to);
+char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r);
+
+size_t BLI_file_descriptor_size(int file);
+size_t BLI_file_size(const char *file);
+
+ /* compare if one was last modified before the other */
+int BLI_file_older(const char *file1, const char *file2);
+
+ /* read ascii file as lines, empty list if reading fails */
+struct LinkNode *BLI_file_read_as_lines(const char *file);
+void BLI_file_free_lines(struct LinkNode *lines);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_storage_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 07c0ceffeb5..58dcf1a5441 100644
--- a/source/blender/blenlib/BLI_storage_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -26,10 +26,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef BLI_STORAGE_TYPES_H
-#define BLI_STORAGE_TYPES_H
-/** \file BLI_storage_types.h
+#ifndef BLI_FILEOPS_TYPES_H
+#define BLI_FILEOPS_TYPES_H
+
+/** \file BLI_fileops_types.h
* \ingroup bli
* \brief Some types for dealing with directories.
*/
@@ -75,5 +76,5 @@ struct dirlink
char *name;
};
-#endif /* BLI_STORAGE_TYPES_H */
+#endif /* BLI_FILEOPS_TYPES_H */
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 4ea48929efb..56df71b5582 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -29,7 +29,7 @@
#ifndef BLI_MEMPOOL_H
#define BLI_MEMPOOL_H
-/** \file BLI_storage.h
+/** \file BLI_mempool.h
* \ingroup bli
* \author Geoffrey Bantle
* \brief Simple fast memory allocator.
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index c5acf7b7f70..3cc6ebcc7da 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -30,7 +30,7 @@
#ifndef BLI_SCANFILL_H
#define BLI_SCANFILL_H
-/** \file BLI_storage.h
+/** \file BLI_scanfill.h
* \ingroup bli
* \since March 2001
* \author nzc
diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h
deleted file mode 100644
index 13c78b711a8..00000000000
--- a/source/blender/blenlib/BLI_storage.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef BLI_STORAGE_H
-#define BLI_STORAGE_H
-
-/** \file BLI_storage.h
- * \ingroup bli
- */
-
-/* for size_t (needed on windows) */
-#include <stddef.h>
-
-struct direntry;
-
-size_t BLI_filesize(int file);
-size_t BLI_filepathsize(const char *path);
-double BLI_diskfree(const char *dir);
-char *BLI_getwdN(char *dir, const int maxncpy);
-
-unsigned int BLI_getdir(const char *dirname, struct direntry **filelist);
-
- /* test if file or directory exists */
-int BLI_exists(const char *name);
- /* test if there is a directory at the specified path */
-int BLI_is_dir(const char *file);
-
-/**
- * Read a file as ASCII lines. An empty list is
- * returned if the file cannot be opened or read.
- *
- * @attention The returned list should be free'd with
- * BLI_free_file_lines.
- *
- * @param name The name of the file to read.
- * @retval A list of strings representing the file lines.
- */
-
-struct LinkNode *BLI_read_file_as_lines(const char *name);
-void BLI_free_file_lines(struct LinkNode *lines);
-
- /* Compare if one was last modified before the other */
-int BLI_file_older(const char *file1, const char *file2);
-
-#endif /* BLI_STORAGE_H */
-
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index ea9f72c19c3..49d849bdf14 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -99,6 +99,7 @@ set(SRC
BLI_edgehash.h
BLI_editVert.h
BLI_fileops.h
+ BLI_fileops_types.h
BLI_fnmatch.h
BLI_ghash.h
BLI_graph.h
@@ -125,8 +126,6 @@ set(SRC
BLI_rand.h
BLI_rect.h
BLI_scanfill.h
- BLI_storage.h
- BLI_storage_types.h
BLI_string.h
BLI_string_utf8.h
BLI_threads.h
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 3a2efbd6feb..fef102d8267 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -65,7 +65,8 @@
return -1 if zlib fails, -2 if the originating file does not exist
note: will remove the "from" file
*/
-int BLI_gzip(const char *from, const char *to) {
+int BLI_file_gzip(const char *from, const char *to)
+{
char buffer[10240];
int file;
int readsize = 0;
@@ -109,7 +110,7 @@ int BLI_gzip(const char *from, const char *to) {
/* gzip the file in from_file and write it to memery to_mem, at most size bytes.
return the unziped size
*/
-char *BLI_ungzip_to_mem(const char *from_file, int *size_r)
+char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
{
gzFile gzfile;
int readsize, size, alloc_size=0;
@@ -150,7 +151,7 @@ char *BLI_ungzip_to_mem(const char *from_file, int *size_r)
/* return 1 when file can be written */
-int BLI_is_writable(const char *filename)
+int BLI_file_is_writable(const char *filename)
{
int file;
@@ -178,7 +179,7 @@ int BLI_is_writable(const char *filename)
}
}
-int BLI_touch(const char *file)
+int BLI_file_touch(const char *file)
{
FILE *f = fopen(file,"r+b");
if (f != NULL) {
@@ -199,7 +200,8 @@ int BLI_touch(const char *file)
static char str[MAXPATHLEN+12];
-int BLI_delete(const char *file, int dir, int recursive) {
+int BLI_delete(const char *file, int dir, int recursive)
+{
int err;
if (recursive) {
@@ -216,7 +218,8 @@ int BLI_delete(const char *file, int dir, int recursive) {
return err;
}
-int BLI_move(const char *file, const char *to) {
+int BLI_move(const char *file, const char *to)
+{
int err;
// windows doesn't support moveing to a directory
@@ -241,7 +244,8 @@ int BLI_move(const char *file, const char *to) {
}
-int BLI_copy_fileops(const char *file, const char *to) {
+int BLI_copy(const char *file, const char *to)
+{
int err;
// windows doesn't support copying to a directory
@@ -266,14 +270,16 @@ int BLI_copy_fileops(const char *file, const char *to) {
return err;
}
-int BLI_link(const char *file, const char *to) {
+int BLI_create_symlink(const char *file, const char *to)
+{
callLocalErrorCallBack("Linking files is unsupported on Windows");
(void)file;
(void)to;
return 1;
}
-void BLI_recurdir_fileops(const char *dirname) {
+void BLI_dir_create_recursive(const char *dirname)
+{
char *lslash;
char tmp[MAXPATHLEN];
@@ -295,7 +301,7 @@ void BLI_recurdir_fileops(const char *dirname) {
if (lslash) {
/* Split about the last slash and recurse */
*lslash = 0;
- BLI_recurdir_fileops(tmp);
+ BLI_dir_create_recursive(tmp);
}
if(dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
@@ -303,7 +309,8 @@ void BLI_recurdir_fileops(const char *dirname) {
callLocalErrorCallBack("Unable to create directory\n");
}
-int BLI_rename(const char *from, const char *to) {
+int BLI_rename(const char *from, const char *to)
+{
if (!BLI_exists(from)) return 0;
/* make sure the filenames are different (case insensitive) before removing */
@@ -343,25 +350,29 @@ int BLI_delete(const char *file, int dir, int recursive)
return -1;
}
-int BLI_move(const char *file, const char *to) {
+int BLI_move(const char *file, const char *to)
+{
BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to);
return system(str);
}
-int BLI_copy_fileops(const char *file, const char *to) {
+int BLI_copy(const char *file, const char *to)
+{
BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to);
return system(str);
}
-int BLI_link(const char *file, const char *to) {
+int BLI_create_symlink(const char *file, const char *to)
+{
BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to);
return system(str);
}
-void BLI_recurdir_fileops(const char *dirname) {
+void BLI_dir_create_recursive(const char *dirname)
+{
char *lslash;
char tmp[MAXPATHLEN];
@@ -373,13 +384,14 @@ void BLI_recurdir_fileops(const char *dirname) {
if (lslash) {
/* Split about the last slash and recurse */
*lslash = 0;
- BLI_recurdir_fileops(tmp);
+ BLI_dir_create_recursive(tmp);
}
mkdir(dirname, 0777);
}
-int BLI_rename(const char *from, const char *to) {
+int BLI_rename(const char *from, const char *to)
+{
if (!BLI_exists(from)) return 0;
if (BLI_exists(to)) if(BLI_delete(to, 0, 0)) return 1;
@@ -388,3 +400,4 @@ int BLI_rename(const char *from, const char *to) {
}
#endif
+
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 91e813a0350..d9176c5f162 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -46,8 +46,6 @@
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
-#include "BLI_storage.h"
-#include "BLI_storage_types.h"
#include "BLI_utildefines.h"
#include "BKE_utildefines.h"
@@ -740,7 +738,7 @@ int BLI_path_cwd(char *path)
if (wasrelative==1) {
char cwd[FILE_MAXDIR + FILE_MAXFILE]= "";
- BLI_getwdN(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */
+ BLI_current_working_dir(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */
if (cwd[0] == '\0') {
printf( "Could not get the current working directory - $PWD for an unknown reason.");
@@ -986,7 +984,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
}
/* try CWD/release/folder_name */
- if(BLI_getwdN(cwd, sizeof(cwd))) {
+ if(BLI_current_working_dir(cwd, sizeof(cwd))) {
if(test_path(targetpath, cwd, "release", relfolder)) {
return 1;
}
@@ -1117,7 +1115,7 @@ char *BLI_get_folder_create(int folder_id, const char *subfolder)
if (!path) {
path = BLI_get_user_folder_notest(folder_id, subfolder);
- if (path) BLI_recurdir_fileops(path);
+ if (path) BLI_dir_create_recursive(path);
}
return path;
@@ -1250,7 +1248,7 @@ void BLI_make_existing_file(const char *name)
/* test exist */
if (BLI_exists(di) == 0) {
- BLI_recurdir_fileops(di);
+ BLI_dir_create_recursive(di);
}
}
@@ -1732,7 +1730,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
BLI_strncpy(fullname, name, maxlen);
if (name[0] == '.') {
char wdir[FILE_MAX]= "";
- BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */
+ BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
// not needed but avoids annoying /./ in name
if(name[1]==SEP)
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 8b383f5fd11..b3caeb71822 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -88,10 +88,9 @@
#include "DNA_listBase.h"
+#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_linklist.h"
-#include "BLI_storage.h"
-#include "BLI_storage_types.h"
#include "BLI_string.h"
#include "BKE_utildefines.h"
@@ -104,7 +103,7 @@ static struct ListBase dirbase_={NULL, NULL};
static struct ListBase *dirbase = &dirbase_;
/* can return NULL when the size is not big enough */
-char *BLI_getwdN(char *dir, const int maxncpy)
+char *BLI_current_working_dir(char *dir, const int maxncpy)
{
const char *pwd= getenv("PWD");
if (pwd){
@@ -116,7 +115,7 @@ char *BLI_getwdN(char *dir, const int maxncpy)
}
-int BLI_compare(struct direntry *entry1, struct direntry *entry2)
+static int bli_compare(struct direntry *entry1, struct direntry *entry2)
{
/* type is equal to stat.st_mode */
@@ -143,7 +142,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2)
}
-double BLI_diskfree(const char *dir)
+double BLI_dir_free_space(const char *dir)
{
#ifdef WIN32
DWORD sectorspc, bytesps, freec, clusters;
@@ -198,7 +197,7 @@ double BLI_diskfree(const char *dir)
#endif
}
-void BLI_builddir(const char *dirname, const char *relname)
+static void bli_builddir(const char *dirname, const char *relname)
{
struct dirent *fname;
struct dirlink *dlink;
@@ -273,7 +272,7 @@ void BLI_builddir(const char *dirname, const char *relname)
}
BLI_freelist(dirbase);
- if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))BLI_compare);
+ if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare);
} else {
printf("%s empty directory\n",dirname);
}
@@ -284,7 +283,7 @@ void BLI_builddir(const char *dirname, const char *relname)
}
}
-void BLI_adddirstrings(void)
+static void bli_adddirstrings(void)
{
char datum[100];
char buf[512];
@@ -392,7 +391,7 @@ void BLI_adddirstrings(void)
}
}
-unsigned int BLI_getdir(const char *dirname, struct direntry **filelist)
+unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist)
{
// reset global variables
// memory stored in files is free()'d in
@@ -401,8 +400,8 @@ unsigned int BLI_getdir(const char *dirname, struct direntry **filelist)
actnum = totnum = 0;
files = NULL;
- BLI_builddir(dirname,"");
- BLI_adddirstrings();
+ bli_builddir(dirname,"");
+ bli_adddirstrings();
if (files) {
*(filelist) = files;
@@ -416,7 +415,7 @@ unsigned int BLI_getdir(const char *dirname, struct direntry **filelist)
}
-size_t BLI_filesize(int file)
+size_t BLI_file_descriptor_size(int file)
{
struct stat buf;
@@ -425,14 +424,14 @@ size_t BLI_filesize(int file)
return (buf.st_size);
}
-size_t BLI_filepathsize(const char *path)
+size_t BLI_file_size(const char *path)
{
int size, file = open(path, O_BINARY|O_RDONLY);
if (file == -1)
return -1;
- size = BLI_filesize(file);
+ size = BLI_file_descriptor_size(file);
close(file);
return size;
}
@@ -474,7 +473,7 @@ int BLI_is_dir(const char *file)
return S_ISDIR(BLI_exists(file));
}
-LinkNode *BLI_read_file_as_lines(const char *name)
+LinkNode *BLI_file_read_as_lines(const char *name)
{
FILE *fp= fopen(name, "r");
LinkNode *lines= NULL;
@@ -515,7 +514,7 @@ LinkNode *BLI_read_file_as_lines(const char *name)
return lines;
}
-void BLI_free_file_lines(LinkNode *lines)
+void BLI_file_free_lines(LinkNode *lines)
{
BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN);
}
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index ded5a95df5a..09e6dcd7bf9 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -34,7 +34,6 @@
#include <stddef.h>
-#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
#include <stdlib.h>
#include <string.h>
@@ -43,11 +42,12 @@
#include "MEM_guardedalloc.h"
-#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
-#include "BLI_string.h"
+#include "BLI_fileops.h"
#include "BLI_ghash.h"
#include "BLI_linklist.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "DNA_genfile.h"
#include "DNA_sdna_types.h"
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index 7a241e007f2..57cdce94b17 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -111,7 +111,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
goto cleanup;
}
- actualsize= BLI_filesize(fd);
+ actualsize= BLI_file_descriptor_size(fd);
lseek(fd, -12, SEEK_END);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 8959a1ed017..752677d047d 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2734,7 +2734,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
/* first write compressed to separate @.gz */
BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath);
- ret = BLI_gzip(tempname, gzname);
+ ret = BLI_file_gzip(tempname, gzname);
if(0==ret) {
/* now rename to real file name, and delete temp @ file too */
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 6c7251016c3..ec3cc0fc984 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -110,7 +110,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob)
// make dest directory if it doesn't exist
BLI_make_existing_file(abs);
- if (BLI_copy_fileops(src, abs) != 0) {
+ if (BLI_copy(src, abs) != 0) {
fprintf(stderr, "Cannot copy image to file's directory. \n");
}
}
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index b411d61fe37..a0b3d0051b4 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -40,9 +40,8 @@ extern "C"
#include "BKE_context.h"
/* make dummy file */
-#include "BLI_storage.h"
-#include "BLI_path_util.h"
#include "BLI_fileops.h"
+#include "BLI_path_util.h"
int collada_import(bContext *C, const char *filepath)
{
@@ -62,7 +61,7 @@ extern "C"
/* annoying, collada crashes if file cant be created! [#27162] */
if(!BLI_exists(filepath)) {
BLI_make_existing_file(filepath); /* makes the dir if its not there */
- if(BLI_touch(filepath) == 0) {
+ if(BLI_file_touch(filepath) == 0) {
return 0;
}
}
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<totfile; i++) {
@@ -662,7 +661,7 @@ static void init_iconfile_list(struct ListBase *list)
}
}
- /* free temporary direntry structure that's been created by BLI_getdir() */
+ /* free temporary direntry structure that's been created by BLI_dir_contents() */
i= totfile-1;
for(; 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);
}
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index e064d7f760d..1084355dd74 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -546,7 +546,7 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
{
ExrHandle *data= (ExrHandle *)handle;
- if(BLI_exists(filename) && BLI_filepathsize(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */
+ if(BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */
data->ifile = new InputFile(filename);
if(data->ifile) {
Box2i dw = data->ifile->header().dataWindow();
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 849b3ff0ce2..1c1e681bb30 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -88,7 +88,7 @@ ImBuf *IMB_loadifffile(int file, int flags)
if(file == -1) return NULL;
- size= BLI_filesize(file);
+ size= BLI_file_descriptor_size(file);
mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
if(mem==(unsigned char*)-1) {
@@ -175,7 +175,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int
if(file == -1) return;
- size= BLI_filesize(file);
+ size= BLI_file_descriptor_size(file);
mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
if(mem==(unsigned char*)-1) {
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 2ab7e55d1f8..d2bf7f75615 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -237,10 +237,10 @@ void IMB_thumb_makedirs(void)
{
char tpath[FILE_MAX];
if (get_thumb_dir(tpath, THB_NORMAL)) {
- BLI_recurdir_fileops(tpath);
+ BLI_dir_create_recursive(tpath);
}
if (get_thumb_dir(tpath, THB_FAIL)) {
- BLI_recurdir_fileops(tpath);
+ BLI_dir_create_recursive(tpath);
}
}
@@ -277,7 +277,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
/* exception, skip images over 100mb */
if(source == THB_SOURCE_IMAGE) {
- const size_t size= BLI_filepathsize(path);
+ const size_t size= BLI_file_size(path);
if(size != -1 && size > THUMB_SIZE_MAX) {
// printf("file too big: %d, skipping %s\n", (int)size, path);
return NULL;
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 7a39cfc93c8..cfd8d9f433b 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -674,7 +674,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#ifdef WITH_PYTHON_MODULE
-#include "BLI_storage.h"
+#include "BLI_fileops.h"
/* TODO, reloading the module isnt functional at the moment. */
static void bpy_module_free(void *mod);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 104a298acf1..5ca0983ffd0 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2753,7 +2753,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
scene_unique_exr_name(scene, str, 0);
- if (BLI_is_writable(str)==0) {
+ if (BLI_file_is_writable(str)==0) {
BKE_report(reports, RPT_ERROR, "Can not save render buffers, check the temp default path");
return 0;
}
@@ -3152,7 +3152,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
}
if(scene->r.mode & R_TOUCH && !BLI_exists(name)) {
BLI_make_existing_file(name); /* makes the dir if its not there */
- BLI_touch(name);
+ BLI_file_touch(name);
}
}
@@ -3175,7 +3175,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
if(G.afbreek==1) {
/* remove touched file */
if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
- if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_filepathsize(name) == 0) {
+ if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) {
BLI_delete(name, 0, 0);
}
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 4cd31b8d894..823df35fc6e 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -574,7 +574,7 @@ void WM_read_history(void)
BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
- lines= BLI_read_file_as_lines(name);
+ lines= BLI_file_read_as_lines(name);
G.recent_files.first = G.recent_files.last = NULL;
@@ -589,7 +589,7 @@ void WM_read_history(void)
}
}
- BLI_free_file_lines(lines);
+ BLI_file_free_lines(lines);
}