Blender V2.61 - r43446

BLI_fileops.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef BLI_FILEOPS_H
00034 #define BLI_FILEOPS_H
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #include "BLI_fileops_types.h"
00041 
00042 /* for size_t (needed on windows) */
00043 #include <stddef.h>
00044 
00045 /* Common */
00046 
00047 int    BLI_exists(const char *path);
00048 int    BLI_copy(const char *path, const char *to);
00049 int    BLI_rename(const char *from, const char *to);
00050 int    BLI_delete(const char *path, int dir, int recursive);
00051 int    BLI_move(const char *path, const char *to);
00052 int    BLI_create_symlink(const char *path, const char *to);
00053 
00054 /* Directories */
00055 
00056 struct direntry;
00057 
00058 int    BLI_is_dir(const char *path);
00059 int    BLI_is_file(const char *path);
00060 void   BLI_dir_create_recursive(const char *dir);
00061 double BLI_dir_free_space(const char *dir);
00062 char  *BLI_current_working_dir(char *dir, const int maxlen);
00063 
00064 unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist);
00065 
00066 /* Files */
00067 
00068 int    BLI_file_is_writable(const char *file);
00069 int    BLI_file_touch(const char *file);
00070 
00071 int    BLI_file_gzip(const char *from, const char *to);
00072 char  *BLI_file_ungzip_to_mem(const char *from_file, int *size_r);
00073 
00074 size_t BLI_file_descriptor_size(int file);
00075 size_t BLI_file_size(const char *file);
00076 
00077     /* compare if one was last modified before the other */
00078 int    BLI_file_older(const char *file1, const char *file2);
00079 
00080     /* read ascii file as lines, empty list if reading fails */
00081 struct LinkNode *BLI_file_read_as_lines(const char *file);
00082 void   BLI_file_free_lines(struct LinkNode *lines);
00083 
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087 
00088 #endif
00089