Add umask and rename compatibility wrappers for Windows

umask() doesn't exist on Windows and is thus a no-op.

rename() only works if the destination doesn't already exist,
so we must unlink before renaming.
This commit is contained in:
Cyril Cleaud
2014-06-26 22:59:17 -07:00
committed by Andrew Ayer
parent dcea03f0d7
commit df2b472cd9
5 changed files with 32 additions and 6 deletions

View File

@@ -35,6 +35,7 @@
#include <ios>
#include <iosfwd>
#include <stdint.h>
#include <sys/types.h>
#include <fstream>
#include <vector>
@@ -69,6 +70,8 @@ void store_be32 (unsigned char*, uint32_t);
bool read_be32 (std::istream& in, uint32_t&);
void write_be32 (std::ostream& out, uint32_t);
void init_std_streams ();
mode_t util_umask (mode_t);
int util_rename (const char*, const char*);
#endif