diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-10-02 17:02:36 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-10-02 17:02:36 +0000 |
commit | 322b785e7a686ea72f7c89e6ad9529a547c62eed (patch) | |
tree | c7596ed2b8a249fe3cac62bda32aa12f30aeca47 /src | |
parent | 7ae633f8a997997524cded2d205d14eeb5f08051 (diff) | |
download | libbu++-322b785e7a686ea72f7c89e6ad9529a547c62eed.tar.gz libbu++-322b785e7a686ea72f7c89e6ad9529a547c62eed.tar.bz2 libbu++-322b785e7a686ea72f7c89e6ad9529a547c62eed.tar.xz libbu++-322b785e7a686ea72f7c89e6ad9529a547c62eed.zip |
More changes to File...turns out tempFile always opens the file for reading and
writing...so...what more do you need? It was ignoring the open flags you gave
it anyway.
Diffstat (limited to '')
-rw-r--r-- | src/file.cpp | 2 | ||||
-rw-r--r-- | src/file.h | 22 | ||||
-rw-r--r-- | src/unit/taf.cpp | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/file.cpp b/src/file.cpp index 417c445..9c8ae90 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
@@ -151,7 +151,7 @@ void Bu::File::setBlocking( bool bBlocking ) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | #ifndef WIN32 | 153 | #ifndef WIN32 |
154 | Bu::File Bu::File::tempFile( Bu::FString &sName, int /*iFlags*/ ) | 154 | Bu::File Bu::File::tempFile( Bu::FString &sName ) |
155 | { | 155 | { |
156 | int afh_d = mkstemp( sName.getStr() ); | 156 | int afh_d = mkstemp( sName.getStr() ); |
157 | 157 | ||
@@ -56,27 +56,27 @@ namespace Bu | |||
56 | 56 | ||
57 | enum { | 57 | enum { |
58 | // Flags | 58 | // Flags |
59 | Read = 0x01, //< Open file for reading | 59 | Read = 0x01, ///< Open file for reading |
60 | Write = 0x02, //< Open file for writing | 60 | Write = 0x02, ///< Open file for writing |
61 | Create = 0x04, //< Create file if it doesn't exist | 61 | Create = 0x04, ///< Create file if it doesn't exist |
62 | Truncate = 0x08, //< Truncate file if it does exist | 62 | Truncate = 0x08, ///< Truncate file if it does exist |
63 | Append = 0x10, //< Always append on every write | 63 | Append = 0x10, ///< Always append on every write |
64 | NonBlock = 0x20, //< Open file in non-blocking mode | 64 | NonBlock = 0x20, ///< Open file in non-blocking mode |
65 | Exclusive = 0x44, //< Create file, if it exists then fail | 65 | Exclusive = 0x44, ///< Create file, if it exists then fail |
66 | 66 | ||
67 | // Helpful mixes | 67 | // Helpful mixes |
68 | ReadWrite = 0x03 //< Open for reading and writing | 68 | ReadWrite = 0x03 ///< Open for reading and writing |
69 | }; | 69 | }; |
70 | /** | 70 | /** |
71 | * Create a temp file and return its handle | 71 | * Create a temp file and return its handle. The file is opened |
72 | * Read/Write. | ||
72 | *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" | 73 | *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" |
73 | * It will alter your (sName) setting the 'X's to random | 74 | * It will alter your (sName) setting the 'X's to random |
74 | * characters. | 75 | * characters. |
75 | *@param sFlags (const char *) Standard file flags 'rb'... etc.. | ||
76 | *@returns (Bu::File) A file object representing your temp file. | 76 | *@returns (Bu::File) A file object representing your temp file. |
77 | */ | 77 | */ |
78 | #ifndef WIN32 | 78 | #ifndef WIN32 |
79 | static Bu::File tempFile( Bu::FString &sName, int iFlags ); | 79 | static Bu::File tempFile( Bu::FString &sName ); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Set the size of the file to (nSize). You can either grow or shrink | 82 | * Set the size of the file to (nSize). You can either grow or shrink |
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index 0a97eba..71bd867 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp | |||
@@ -29,7 +29,7 @@ public: | |||
29 | { | 29 | { |
30 | #define FN_TMP ("/tmp/tmpXXXXXXXX") | 30 | #define FN_TMP ("/tmp/tmpXXXXXXXX") |
31 | Bu::FString sFnTmp(FN_TMP); | 31 | Bu::FString sFnTmp(FN_TMP); |
32 | Bu::File fOut = Bu::File::tempFile( sFnTmp, Bu::File::Write ); | 32 | Bu::File fOut = Bu::File::tempFile( sFnTmp ); |
33 | const char *data = | 33 | const char *data = |
34 | "{test: name=\"Bob\"}" | 34 | "{test: name=\"Bob\"}" |
35 | ; | 35 | ; |