diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llcommon/llfile.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/llfile.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/linden/indra/llcommon/llfile.cpp b/linden/indra/llcommon/llfile.cpp index d9fd360..feac28f 100644 --- a/linden/indra/llcommon/llfile.cpp +++ b/linden/indra/llcommon/llfile.cpp | |||
@@ -48,6 +48,19 @@ int LLFile::mkdir(const char* dirname, int perms) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | // static | 50 | // static |
51 | int LLFile::rmdir(const char* dirname) | ||
52 | { | ||
53 | #if LL_WINDOWS | ||
54 | // permissions are ignored on Windows | ||
55 | std::string utf8dirname = dirname; | ||
56 | llutf16string utf16dirname = utf8str_to_utf16str(utf8dirname); | ||
57 | return _wrmdir(utf16dirname.c_str()); | ||
58 | #else | ||
59 | return ::rmdir(dirname); | ||
60 | #endif | ||
61 | } | ||
62 | |||
63 | // static | ||
51 | LLFILE* LLFile::fopen(const char* filename, const char* mode) /* Flawfinder: ignore */ | 64 | LLFILE* LLFile::fopen(const char* filename, const char* mode) /* Flawfinder: ignore */ |
52 | { | 65 | { |
53 | #if LL_WINDOWS | 66 | #if LL_WINDOWS |
@@ -184,9 +197,9 @@ void llifstream::close() | |||
184 | } | 197 | } |
185 | } | 198 | } |
186 | 199 | ||
187 | void llifstream::open(const char *_Filename, | 200 | void llifstream::open(const char* _Filename, /* Flawfinder: ignore */ |
188 | ios_base::openmode _Mode, | 201 | ios_base::openmode _Mode, |
189 | int _Prot) /* Flawfinder: ignore */ | 202 | int _Prot) |
190 | { // open a C stream with specified mode | 203 | { // open a C stream with specified mode |
191 | 204 | ||
192 | FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::in, _Prot); | 205 | FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::in, _Prot); |
@@ -197,6 +210,7 @@ void llifstream::open(const char *_Filename, | |||
197 | } | 210 | } |
198 | llassert(_Filebuffer == NULL); | 211 | llassert(_Filebuffer == NULL); |
199 | _Filebuffer = new _Myfb(filep); | 212 | _Filebuffer = new _Myfb(filep); |
213 | _ShouldClose = true; | ||
200 | _Myios::init(_Filebuffer); | 214 | _Myios::init(_Filebuffer); |
201 | } | 215 | } |
202 | 216 | ||
@@ -208,13 +222,17 @@ bool llifstream::is_open() const | |||
208 | } | 222 | } |
209 | llifstream::~llifstream() | 223 | llifstream::~llifstream() |
210 | { | 224 | { |
225 | if (_ShouldClose) | ||
226 | { | ||
227 | close(); | ||
228 | } | ||
211 | delete _Filebuffer; | 229 | delete _Filebuffer; |
212 | } | 230 | } |
213 | 231 | ||
214 | llifstream::llifstream(const char *_Filename, | 232 | llifstream::llifstream(const char *_Filename, |
215 | ios_base::openmode _Mode, | 233 | ios_base::openmode _Mode, |
216 | int _Prot) | 234 | int _Prot) |
217 | : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL) | 235 | : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) |
218 | 236 | ||
219 | { // construct with named file and specified mode | 237 | { // construct with named file and specified mode |
220 | open(_Filename, _Mode | ios_base::in, _Prot); /* Flawfinder: ignore */ | 238 | open(_Filename, _Mode | ios_base::in, _Prot); /* Flawfinder: ignore */ |
@@ -230,9 +248,9 @@ bool llofstream::is_open() const | |||
230 | return false; | 248 | return false; |
231 | } | 249 | } |
232 | 250 | ||
233 | void llofstream::open(const char *_Filename, | 251 | void llofstream::open(const char* _Filename, /* Flawfinder: ignore */ |
234 | ios_base::openmode _Mode, | 252 | ios_base::openmode _Mode, |
235 | int _Prot) /* Flawfinder: ignore */ | 253 | int _Prot) |
236 | { // open a C stream with specified mode | 254 | { // open a C stream with specified mode |
237 | 255 | ||
238 | FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::out, _Prot); | 256 | FILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::out, _Prot); |