summaryrefslogtreecommitdiff
path: root/src/file.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-24 15:10:19 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-24 15:10:19 +0000
commitecc191f590f76584a14c9c51727412b0b7b3086e (patch)
treeb27ee434ed541ba3a386ff6a3238f66b9451ef22 /src/file.cpp
parent71191e311d949b1b7bdd74fc36a14306f492c181 (diff)
downloadlibbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.gz
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.bz2
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.xz
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.zip
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.
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp14
1 files changed, 11 insertions, 3 deletions
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 )
187#endif 187#endif
188} 188}
189 189
190#ifndef WIN32
191Bu::File Bu::File::tempFile( Bu::FString &sName ) 190Bu::File Bu::File::tempFile( Bu::FString &sName )
192{ 191{
192#ifndef WIN32
193 int afh_d = mkstemp( sName.getStr() ); 193 int afh_d = mkstemp( sName.getStr() );
194 194
195 return Bu::File( afh_d ); 195 return Bu::File( afh_d );
196#else
197 return Bu::File( sName, Bu::File::Write|Bu::File::Create );
198#endif
196} 199}
197 200
198void Bu::File::truncate( long nSize ) 201void Bu::File::setSize( long iSize )
199{ 202{
200 ftruncate( fd, nSize ); 203#ifndef WIN32
204 ftruncate( fd, iSize );
205#else
206#warning Bu::File::setSize not implemented on this platform
207#endif
201} 208}
202 209
210#ifndef WIN32
203void Bu::File::chmod( mode_t t ) 211void Bu::File::chmod( mode_t t )
204{ 212{
205 fchmod( fd, t ); 213 fchmod( fd, t );