2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
* Reorganised mar-01 nzc
|
|
|
|
* Some really low-level file thingies.
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:37:56 +00:00
|
|
|
/** \file blender/blenlib/intern/storage.c
|
|
|
|
* \ingroup bli
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdio.h>
|
2003-04-26 16:02:26 +00:00
|
|
|
#include <stdlib.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#include <dirent.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2011-09-21 08:40:30 +00:00
|
|
|
#if defined (__sun__) || defined (__sun) || defined (__NetBSD__)
|
2008-01-26 20:36:14 +00:00
|
|
|
#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
|
2008-12-14 17:32:24 +00:00
|
|
|
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <sys/statfs.h>
|
|
|
|
#endif
|
|
|
|
|
2009-08-14 13:13:36 +00:00
|
|
|
#if defined (__FreeBSD__) || defined (__OpenBSD__)
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#endif
|
|
|
|
|
2005-02-25 14:50:57 +00:00
|
|
|
#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux)
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <sys/vfs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
/* For statfs */
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#endif /* __APPLE__ */
|
|
|
|
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h> /* strcpy etc.. */
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <unistd.h> /* */
|
|
|
|
#include <pwd.h>
|
|
|
|
#endif
|
|
|
|
|
2009-09-06 13:20:05 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <io.h>
|
|
|
|
#include <direct.h>
|
|
|
|
#include "BLI_winstuff.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* lib includes */
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
2009-12-13 17:46:30 +00:00
|
|
|
#include "BLI_listbase.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_linklist.h"
|
2011-02-12 10:37:37 +00:00
|
|
|
#include "BLI_storage.h"
|
2009-12-13 17:46:30 +00:00
|
|
|
#include "BLI_storage_types.h"
|
|
|
|
#include "BLI_string.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2006-03-19 13:28:01 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* vars: */
|
|
|
|
static int totnum,actnum;
|
|
|
|
static struct direntry *files;
|
|
|
|
|
2011-03-03 17:58:06 +00:00
|
|
|
static struct ListBase dirbase_={NULL, NULL};
|
2002-10-12 11:37:38 +00:00
|
|
|
static struct ListBase *dirbase = &dirbase_;
|
|
|
|
|
2011-02-13 03:21:27 +00:00
|
|
|
/* can return NULL when the size is not big enough */
|
2011-02-12 10:37:37 +00:00
|
|
|
char *BLI_getwdN(char *dir, const int maxncpy)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2011-02-12 10:37:37 +00:00
|
|
|
const char *pwd= getenv("PWD");
|
|
|
|
if (pwd){
|
|
|
|
BLI_strncpy(dir, pwd, maxncpy);
|
|
|
|
return dir;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2011-02-12 10:37:37 +00:00
|
|
|
|
|
|
|
return getcwd(dir, maxncpy);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int BLI_compare(struct direntry *entry1, struct direntry *entry2)
|
|
|
|
{
|
2003-04-26 16:02:26 +00:00
|
|
|
/* type is equal to stat.st_mode */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (S_ISDIR(entry1->type)){
|
|
|
|
if (S_ISDIR(entry2->type)==0) return (-1);
|
|
|
|
} else{
|
|
|
|
if (S_ISDIR(entry2->type)) return (1);
|
|
|
|
}
|
|
|
|
if (S_ISREG(entry1->type)){
|
|
|
|
if (S_ISREG(entry2->type)==0) return (-1);
|
|
|
|
} else{
|
|
|
|
if (S_ISREG(entry2->type)) return (1);
|
|
|
|
}
|
|
|
|
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
|
|
|
|
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
|
2005-01-03 14:17:33 +00:00
|
|
|
|
|
|
|
/* make sure "." and ".." are always first */
|
|
|
|
if( strcmp(entry1->relname, ".")==0 ) return (-1);
|
|
|
|
if( strcmp(entry2->relname, ".")==0 ) return (1);
|
|
|
|
if( strcmp(entry1->relname, "..")==0 ) return (-1);
|
2009-03-11 23:22:07 +00:00
|
|
|
if( strcmp(entry2->relname, "..")==0 ) return (1);
|
|
|
|
|
2009-06-08 20:08:19 +00:00
|
|
|
return (BLI_natstrcmp(entry1->relname,entry2->relname));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
double BLI_diskfree(const char *dir)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
#ifdef WIN32
|
|
|
|
DWORD sectorspc, bytesps, freec, clusters;
|
|
|
|
char tmp[4];
|
|
|
|
|
|
|
|
tmp[0]='\\'; tmp[1]=0; /* Just a failsafe */
|
|
|
|
if (dir[0]=='/' || dir[0]=='\\') {
|
|
|
|
tmp[0]='\\';
|
|
|
|
tmp[1]=0;
|
|
|
|
} else if (dir[1]==':') {
|
|
|
|
tmp[0]=dir[0];
|
|
|
|
tmp[1]=':';
|
|
|
|
tmp[2]='\\';
|
|
|
|
tmp[3]=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetDiskFreeSpace(tmp,§orspc, &bytesps, &freec, &clusters);
|
|
|
|
|
|
|
|
return (double) (freec*bytesps*sectorspc);
|
|
|
|
#else
|
2008-01-26 20:36:14 +00:00
|
|
|
|
2011-09-21 08:40:30 +00:00
|
|
|
#if defined (__sun__) || defined (__sun) || defined (__NetBSD__)
|
2008-01-26 20:36:14 +00:00
|
|
|
struct statvfs disk;
|
|
|
|
#else
|
2002-10-12 11:37:38 +00:00
|
|
|
struct statfs disk;
|
2008-01-26 20:36:14 +00:00
|
|
|
#endif
|
2007-10-21 09:32:18 +00:00
|
|
|
char name[FILE_MAXDIR],*slash;
|
|
|
|
int len = strlen(dir);
|
|
|
|
|
|
|
|
if (len >= FILE_MAXDIR) /* path too long */
|
|
|
|
return -1;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
strcpy(name,dir);
|
|
|
|
|
2007-10-21 09:32:18 +00:00
|
|
|
if(len){
|
2002-10-12 11:37:38 +00:00
|
|
|
slash = strrchr(name,'/');
|
|
|
|
if (slash) slash[1] = 0;
|
|
|
|
} else strcpy(name,"/");
|
|
|
|
|
2005-04-30 09:57:35 +00:00
|
|
|
#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__)
|
2002-10-12 11:37:38 +00:00
|
|
|
if (statfs(name, &disk)) return(-1);
|
|
|
|
#endif
|
|
|
|
|
2011-09-21 08:40:30 +00:00
|
|
|
#if defined (__sun__) || defined (__sun) || defined (__NetBSD__)
|
2008-01-26 20:36:14 +00:00
|
|
|
if (statvfs(name, &disk)) return(-1);
|
2008-12-14 17:32:24 +00:00
|
|
|
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
|
2008-01-26 20:36:14 +00:00
|
|
|
/* WARNING - This may not be supported by geeneric unix os's - Campbell */
|
|
|
|
if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return ( ((double) disk.f_bsize) * ((double) disk.f_bfree));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-12-03 17:05:21 +00:00
|
|
|
void BLI_builddir(const char *dirname, const char *relname)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
struct dirent *fname;
|
|
|
|
struct dirlink *dlink;
|
2011-01-11 07:40:31 +00:00
|
|
|
int rellen, newnum = 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
char buf[256];
|
|
|
|
DIR *dir;
|
|
|
|
|
|
|
|
strcpy(buf,relname);
|
|
|
|
rellen=strlen(relname);
|
|
|
|
|
|
|
|
if (rellen){
|
|
|
|
buf[rellen]='/';
|
|
|
|
rellen++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chdir(dirname) == -1){
|
|
|
|
perror(dirname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
if ( (dir = (DIR *)opendir(".")) ){
|
2002-10-12 11:37:38 +00:00
|
|
|
while ((fname = (struct dirent*) readdir(dir)) != NULL) {
|
2010-03-20 14:23:56 +00:00
|
|
|
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
|
|
|
|
if (dlink){
|
|
|
|
strcpy(buf+rellen,fname->d_name);
|
|
|
|
dlink->name = BLI_strdup(buf);
|
|
|
|
BLI_addhead(dirbase,dlink);
|
|
|
|
newnum++;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newnum){
|
|
|
|
|
2010-08-11 22:36:43 +00:00
|
|
|
if(files) {
|
|
|
|
void *tmp= realloc(files, (totnum+newnum) * sizeof(struct direntry));
|
|
|
|
if(tmp) {
|
|
|
|
files= (struct direntry *)tmp;
|
|
|
|
}
|
|
|
|
else { /* realloc fail */
|
|
|
|
free(files);
|
|
|
|
files= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(files==NULL)
|
|
|
|
files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (files){
|
|
|
|
dlink = (struct dirlink *) dirbase->first;
|
|
|
|
while(dlink){
|
|
|
|
memset(&files[actnum], 0 , sizeof(struct direntry));
|
|
|
|
files[actnum].relname = dlink->name;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
files[actnum].path = BLI_strdupcat(dirname, dlink->name);
|
2009-07-26 12:49:43 +00:00
|
|
|
// use 64 bit file size, only needed for WIN32 and WIN64.
|
2009-07-26 12:40:44 +00:00
|
|
|
// Excluding other than current MSVC compiler until able to test.
|
2009-07-26 12:49:43 +00:00
|
|
|
#if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
|
2009-07-26 12:40:44 +00:00
|
|
|
_stat64(dlink->name,&files[actnum].s);
|
2010-07-26 10:41:26 +00:00
|
|
|
#elif defined(__MINGW32__)
|
|
|
|
_stati64(dlink->name,&files[actnum].s);
|
2009-07-26 12:40:44 +00:00
|
|
|
#else
|
2002-10-12 11:37:38 +00:00
|
|
|
stat(dlink->name,&files[actnum].s);
|
2009-07-26 12:40:44 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
files[actnum].type=files[actnum].s.st_mode;
|
|
|
|
files[actnum].flags = 0;
|
|
|
|
totnum++;
|
|
|
|
actnum++;
|
|
|
|
dlink = dlink->next;
|
|
|
|
}
|
|
|
|
} else{
|
|
|
|
printf("Couldn't get memory for dir\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_freelist(dirbase);
|
|
|
|
if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))BLI_compare);
|
|
|
|
} else {
|
|
|
|
printf("%s empty directory\n",dirname);
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
} else {
|
|
|
|
printf("%s non-existant directory\n",dirname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
void BLI_adddirstrings(void)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
char datum[100];
|
2009-06-08 20:08:19 +00:00
|
|
|
char buf[512];
|
2002-10-12 11:37:38 +00:00
|
|
|
char size[250];
|
2010-12-03 17:05:21 +00:00
|
|
|
static const char * types[8] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"};
|
2002-10-12 11:37:38 +00:00
|
|
|
int num, mode;
|
2005-04-30 09:57:35 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
__int64 st_size;
|
|
|
|
#else
|
2008-02-17 18:09:53 +00:00
|
|
|
off_t st_size;
|
2005-04-30 09:57:35 +00:00
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
struct direntry * file;
|
|
|
|
struct tm *tm;
|
2004-05-06 20:53:05 +00:00
|
|
|
time_t zero= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
for(num=0, file= files; num<actnum; num++, file++){
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
mode = 0;
|
2011-10-19 23:10:54 +00:00
|
|
|
BLI_strncpy(file->mode1, types[0], sizeof(file->mode1));
|
|
|
|
BLI_strncpy(file->mode2, types[0], sizeof(file->mode2));
|
|
|
|
BLI_strncpy(file->mode3, types[0], sizeof(file->mode3));
|
2002-10-12 11:37:38 +00:00
|
|
|
#else
|
|
|
|
mode = file->s.st_mode;
|
|
|
|
|
2011-10-19 23:10:54 +00:00
|
|
|
BLI_strncpy(file->mode1, types[(mode & 0700) >> 6], sizeof(file->mode1));
|
|
|
|
BLI_strncpy(file->mode2, types[(mode & 0070) >> 3], sizeof(file->mode2));
|
|
|
|
BLI_strncpy(file->mode3, types[(mode & 0007)], sizeof(file->mode3));
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l';
|
|
|
|
|
|
|
|
if (mode & (S_ISUID | S_ISGID)){
|
|
|
|
if (file->mode1[2]=='x') file->mode1[2]='s';
|
|
|
|
else file->mode1[2]='S';
|
|
|
|
|
|
|
|
if (file->mode2[2]=='x')file->mode2[2]='s';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode & S_ISVTX){
|
|
|
|
if (file->mode3[2] == 'x') file->mode3[2] = 't';
|
|
|
|
else file->mode3[2] = 'T';
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WIN32
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
strcpy(file->owner,"user");
|
2002-10-12 11:37:38 +00:00
|
|
|
#else
|
2005-03-29 16:43:39 +00:00
|
|
|
{
|
|
|
|
struct passwd *pwuser;
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
pwuser = getpwuid(file->s.st_uid);
|
2005-03-29 16:43:39 +00:00
|
|
|
if ( pwuser ) {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
|
2005-03-29 16:43:39 +00:00
|
|
|
} else {
|
2011-08-30 10:07:50 +00:00
|
|
|
BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
|
2010-03-22 09:30:00 +00:00
|
|
|
}
|
2005-03-29 16:43:39 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
tm= localtime(&file->s.st_mtime);
|
2004-05-06 20:53:05 +00:00
|
|
|
// prevent impossible dates in windows
|
|
|
|
if(tm==NULL) tm= localtime(&zero);
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
strftime(file->time, 8, "%H:%M", tm);
|
|
|
|
strftime(file->date, 16, "%d-%b-%y", tm);
|
2004-05-06 20:53:05 +00:00
|
|
|
|
2007-03-07 06:19:15 +00:00
|
|
|
/*
|
|
|
|
* Seems st_size is signed 32-bit value in *nix and Windows. This
|
|
|
|
* will buy us some time until files get bigger than 4GB or until
|
|
|
|
* everyone starts using __USE_FILE_OFFSET64 or equivalent.
|
|
|
|
*/
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
st_size= file->s.st_size;
|
2009-03-14 13:12:11 +00:00
|
|
|
|
|
|
|
if (st_size > 1024*1024*1024) {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
sprintf(file->size, "%.2f GB", ((double)st_size)/(1024*1024*1024));
|
2009-03-14 13:12:11 +00:00
|
|
|
}
|
|
|
|
else if (st_size > 1024*1024) {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
sprintf(file->size, "%.1f MB", ((double)st_size)/(1024*1024));
|
2009-03-14 13:12:11 +00:00
|
|
|
}
|
|
|
|
else if (st_size > 1024) {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
sprintf(file->size, "%d KB", (int)(st_size/1024));
|
2009-03-14 13:12:11 +00:00
|
|
|
}
|
|
|
|
else {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
sprintf(file->size, "%d B", (int)st_size);
|
2009-03-14 13:12:11 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-27 20:16:41 +00:00
|
|
|
strftime(datum, 32, "%d-%b-%y %H:%M", tm);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (st_size < 1000) {
|
2005-06-04 16:22:50 +00:00
|
|
|
sprintf(size, "%10d", (int) st_size);
|
2002-10-12 11:37:38 +00:00
|
|
|
} else if (st_size < 1000 * 1000) {
|
2005-06-04 16:22:50 +00:00
|
|
|
sprintf(size, "%6d %03d", (int) (st_size / 1000), (int) (st_size % 1000));
|
2002-10-12 11:37:38 +00:00
|
|
|
} else if (st_size < 100 * 1000 * 1000) {
|
2005-06-04 16:22:50 +00:00
|
|
|
sprintf(size, "%2d %03d %03d", (int) (st_size / (1000 * 1000)), (int) ((st_size / 1000) % 1000), (int) ( st_size % 1000));
|
2002-10-12 11:37:38 +00:00
|
|
|
} else {
|
2005-06-04 16:22:50 +00:00
|
|
|
sprintf(size, "> %4.1f M", (double) (st_size / (1024.0 * 1024.0)));
|
|
|
|
sprintf(size, "%10d", (int) st_size);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, file->owner, file->date, file->time, size,
|
|
|
|
file->relname);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
file->string=MEM_mallocN(strlen(buf)+1, "filestring");
|
|
|
|
if (file->string){
|
|
|
|
strcpy(file->string,buf);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
unsigned int BLI_getdir(const char *dirname, struct direntry **filelist)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
// reset global variables
|
|
|
|
// memory stored in files is free()'d in
|
|
|
|
// filesel.c:freefilelist()
|
|
|
|
|
|
|
|
actnum = totnum = 0;
|
2011-03-03 17:58:06 +00:00
|
|
|
files = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
BLI_builddir(dirname,"");
|
|
|
|
BLI_adddirstrings();
|
|
|
|
|
|
|
|
if (files) {
|
|
|
|
*(filelist) = files;
|
|
|
|
} else {
|
|
|
|
// keep blender happy. Blender stores this in a variable
|
|
|
|
// where 0 has special meaning.....
|
|
|
|
*(filelist) = files = malloc(sizeof(struct direntry));
|
|
|
|
}
|
|
|
|
|
|
|
|
return(actnum);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-15 06:43:36 +00:00
|
|
|
size_t BLI_filesize(int file)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
struct stat buf;
|
|
|
|
|
|
|
|
if (file <= 0) return (-1);
|
|
|
|
fstat(file, &buf);
|
|
|
|
return (buf.st_size);
|
|
|
|
}
|
|
|
|
|
2010-09-15 06:43:36 +00:00
|
|
|
size_t BLI_filepathsize(const char *path)
|
2008-01-21 22:10:20 +00:00
|
|
|
{
|
|
|
|
int size, file = open(path, O_BINARY|O_RDONLY);
|
|
|
|
|
2010-09-15 06:43:36 +00:00
|
|
|
if (file == -1)
|
2008-01-21 22:10:20 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
size = BLI_filesize(file);
|
|
|
|
close(file);
|
|
|
|
return size;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
int BLI_exist(const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2010-07-19 09:19:54 +00:00
|
|
|
#if defined(WIN32) && !defined(__MINGW32__)
|
2010-07-14 23:39:23 +00:00
|
|
|
struct _stat64i32 st;
|
2006-03-19 13:28:01 +00:00
|
|
|
/* in Windows stat doesn't recognize dir ending on a slash
|
|
|
|
To not break code where the ending slash is expected we
|
|
|
|
don't mess with the argument name directly here - elubie */
|
|
|
|
char tmp[FILE_MAXDIR+FILE_MAXFILE];
|
2010-07-14 23:39:23 +00:00
|
|
|
int len, res;
|
2006-03-19 13:28:01 +00:00
|
|
|
BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE);
|
|
|
|
len = strlen(tmp);
|
|
|
|
if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
|
2010-07-19 09:19:54 +00:00
|
|
|
res = _stat(tmp, &st);
|
2010-07-14 23:39:23 +00:00
|
|
|
if (res == -1) return(0);
|
2010-07-26 10:41:26 +00:00
|
|
|
#elif defined(__MINGW32__)
|
|
|
|
struct _stati64 st;
|
2010-07-20 19:26:53 +00:00
|
|
|
char tmp[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
int len, res;
|
|
|
|
BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE);
|
|
|
|
len = strlen(tmp);
|
|
|
|
if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
|
2010-07-26 10:41:26 +00:00
|
|
|
res = _stati64(tmp, &st);
|
2010-07-20 19:26:53 +00:00
|
|
|
if (res) return(0);
|
2006-03-19 13:28:01 +00:00
|
|
|
#else
|
2010-07-14 23:39:23 +00:00
|
|
|
struct stat st;
|
2006-03-19 13:28:01 +00:00
|
|
|
if (stat(name,&st)) return(0);
|
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
return(st.st_mode);
|
|
|
|
}
|
|
|
|
|
2009-10-16 10:22:11 +00:00
|
|
|
/* would be better in fileops.c except that it needs stat.h so add here */
|
2011-09-28 05:53:40 +00:00
|
|
|
int BLI_is_dir(const char *file)
|
|
|
|
{
|
2009-10-16 10:22:11 +00:00
|
|
|
return S_ISDIR(BLI_exist(file));
|
|
|
|
}
|
|
|
|
|
2011-02-12 10:37:37 +00:00
|
|
|
LinkNode *BLI_read_file_as_lines(const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
FILE *fp= fopen(name, "r");
|
|
|
|
LinkNode *lines= NULL;
|
|
|
|
char *buf;
|
2011-09-25 12:33:51 +00:00
|
|
|
size_t size;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (!fp) return NULL;
|
|
|
|
|
|
|
|
fseek(fp, 0, SEEK_END);
|
2011-09-25 12:33:51 +00:00
|
|
|
size= (size_t)ftell(fp);
|
2002-10-12 11:37:38 +00:00
|
|
|
fseek(fp, 0, SEEK_SET);
|
|
|
|
|
2010-02-08 13:55:31 +00:00
|
|
|
buf= MEM_mallocN(size, "file_as_lines");
|
2002-10-12 11:37:38 +00:00
|
|
|
if (buf) {
|
2011-09-27 01:32:27 +00:00
|
|
|
size_t i, last= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* size = because on win32 reading
|
|
|
|
* all the bytes in the file will return
|
|
|
|
* less bytes because of crnl changes.
|
|
|
|
*/
|
|
|
|
size= fread(buf, 1, size, fp);
|
|
|
|
for (i=0; i<=size; i++) {
|
|
|
|
if (i==size || buf[i]=='\n') {
|
|
|
|
char *line= BLI_strdupn(&buf[last], i-last);
|
|
|
|
|
|
|
|
BLI_linklist_prepend(&lines, line);
|
|
|
|
last= i+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-08 13:55:31 +00:00
|
|
|
MEM_freeN(buf);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
BLI_linklist_reverse(&lines);
|
|
|
|
return lines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BLI_free_file_lines(LinkNode *lines)
|
|
|
|
{
|
|
|
|
BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN);
|
|
|
|
}
|
Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
|
|
|
|
|
|
|
int BLI_file_older(const char *file1, const char *file2)
|
|
|
|
{
|
|
|
|
struct stat st1, st2;
|
|
|
|
|
|
|
|
if(stat(file1, &st1)) return 0;
|
|
|
|
if(stat(file2, &st2)) return 0;
|
|
|
|
|
|
|
|
return (st1.st_mtime < st2.st_mtime);
|
|
|
|
}
|
|
|
|
|