From 5301edc38306c27143f38d74085e6c095688f6aa Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 10 Oct 2003 13:55:08 +0000 Subject: some cleanup svn-id: r10720 --- common/file.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'common/file.cpp') diff --git a/common/file.cpp b/common/file.cpp index 1110c683b5..cb6eb4545a 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -23,7 +23,7 @@ #include "common/util.h" -char *File::_defaultDirectory = 0; +Common::String File::_defaultDirectory; FILE *File::fopenNoCase(const char *filename, const char *directory, const char *mode) { @@ -119,9 +119,8 @@ FILE *File::fopenNoCase(const char *filename, const char *directory, const char return NULL; } -void File::setDefaultDirectory(const char *directory) { - free(_defaultDirectory); - _defaultDirectory = strdup(directory); +void File::setDefaultDirectory(const Common::String &directory) { + _defaultDirectory = directory; } File::File() { @@ -147,7 +146,7 @@ bool File::open(const char *filename, const char *directory, int mode, byte encb // If no directory was specified, use the default directory (if any). if (directory == NULL) - directory = _defaultDirectory ? _defaultDirectory : ""; + directory = _defaultDirectory.isEmpty() ? "" : _defaultDirectory.c_str(); clearIOFailed(); -- cgit v1.2.3