WvStreams
wvfileutils.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2005 Net Integration Technologies, Inc.
00004  *
00005  * Various little file functions...
00006  *
00007  */
00008 
00009 #ifndef __WVFILEUTILS_H
00010 #define __WVFILEUTILS_H
00011 
00012 #include "wvstring.h"
00013 #include "wvstringlist.h"
00014 
00018 int wvmkdir(WvStringParm _dir, int create_mode = 0700);
00019 
00027 int mkdirp(WvStringParm _dir, int create_mode = 0700);
00028 
00034 void rm_rf(WvStringParm _dir);
00035 
00043 bool fcopy(WvStringParm src, WvStringParm dst);
00044 bool fcopy(WvStringParm srcdir, WvStringParm dstdir, WvStringParm relname);
00045 
00051 bool ftouch(WvStringParm file, time_t mtime = 0);
00052 
00057 WvString wvreadlink(WvStringParm path);
00058 
00067 bool samedate(WvStringParm file1, WvStringParm file2);
00068 bool samedate(WvStringParm dir1, WvStringParm dir2, WvStringParm relname);
00069 
00074 #ifndef _WIN32
00075 bool wvfnmatch(WvStringList &patterns, WvStringParm name, int flags = 0);
00076 #endif
00077 
00081 FILE *wvtmpfile();
00082 
00083 /* Returns a unique filename suitable for a temporary file. Obviously there is
00084  * the caveat that someone else may claim this file name before you open it:
00085  * do not use this routine where that race may be a real concern (this would
00086  * apply only to security-sensitive code)
00087  */
00088 WvString wvtmpfilename(WvStringParm prefix);
00089 
00090 #ifndef _WIN32
00091 
00094 int wvchmod(const char *path, mode_t mode);
00095 #endif
00096 
00100 #ifndef _WIN32
00101 mode_t get_umask();
00102 #endif
00103 
00104 #endif // __WVFILEUTILS_H