From ecc191f590f76584a14c9c51727412b0b7b3086e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 May 2010 15:10:19 +0000 Subject: Changed the Bu::Stream API, setSize is now standard. There may be a few more things that should be added. A few of them still need to be implemented. I know that truncate for Bu::File is possible on windows, I've used it before, but hell if I can find it. Myriad also needs the setSize function completed. --- src/file.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index f1f63e4..a0c3fd8 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -187,19 +187,27 @@ void Bu::File::setBlocking( bool bBlocking ) #endif } -#ifndef WIN32 Bu::File Bu::File::tempFile( Bu::FString &sName ) { +#ifndef WIN32 int afh_d = mkstemp( sName.getStr() ); return Bu::File( afh_d ); +#else + return Bu::File( sName, Bu::File::Write|Bu::File::Create ); +#endif } -void Bu::File::truncate( long nSize ) +void Bu::File::setSize( long iSize ) { - ftruncate( fd, nSize ); +#ifndef WIN32 + ftruncate( fd, iSize ); +#else +#warning Bu::File::setSize not implemented on this platform +#endif } +#ifndef WIN32 void Bu::File::chmod( mode_t t ) { fchmod( fd, t ); -- cgit v1.2.3