From 1ce553ac8025e64f298b1886d5c6cee4bb4a9901 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 19 Jan 2013 17:06:27 -0800 Subject: [PATCH] Add plStatusLog to the list of converted interface, in order to fix my log output dir screw-up --- .../pfConsole/pfConsoleCommands.cpp | 4 +- .../PubUtilLib/plPipeline/plDebugText.h | 20 +- .../plPipeline/plStatusLogDrawer.cpp | 8 +- .../PubUtilLib/plStatusLog/plStatusLog.cpp | 233 +++++------------- .../PubUtilLib/plStatusLog/plStatusLog.h | 41 ++- Sources/Tools/MaxConvert/plMeshConverter.cpp | 5 +- 6 files changed, 89 insertions(+), 222 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index d4095016..d27bcca5 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -462,7 +462,7 @@ PF_CONSOLE_BASE_CMD( PrevStatusLog, "", "Cycles backwards through the status log PF_CONSOLE_BASE_CMD( ShowStatusLog, "string logName", "Advances the status log display to the given log" ) { - plStatusLogMgr::GetInstance().SetCurrStatusLog( params[ 0 ] ); + plStatusLogMgr::GetInstance().SetCurrStatusLog(static_cast(params[0])); } #endif // LIMIT_CONSOLE_COMMANDS @@ -481,7 +481,7 @@ PF_CONSOLE_BASE_CMD( EnableLogging, "", "Turns on logging" ) PF_CONSOLE_BASE_CMD( DumpLogs, "string folderName", "Dumps all current logs to the folder specified, relative to the log folder" ) { - plStatusLogMgr::GetInstance().DumpLogs( params[ 0 ] ); + plStatusLogMgr::GetInstance().DumpLogs(static_cast(params[0])); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h index 8242a6a8..f5075bb4 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h @@ -97,11 +97,17 @@ class plDebugText static plDebugText &Instance( void ) { return fInstance; } - uint32_t CalcStringWidth( const char *string ); + uint32_t CalcStringWidth(const char *string); + uint32_t CalcStringWidth_TEMP(const plString &string) { return CalcStringWidth(string.c_str()); } + + void DrawString(uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style = 0); - void DrawString( uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style = 0 ); + void DrawString_TEMP(uint16_t x, uint16_t y, const plString &string, uint32_t hexColor, uint8_t style = 0) + { + DrawString(x, y, string.c_str(), hexColor, style); + } - void DrawString( uint16_t x, uint16_t y, const char *string, hsColorRGBA &color, uint8_t style = 0 ) + void DrawString(uint16_t x, uint16_t y, const plString &string, hsColorRGBA &color, uint8_t style = 0) { uint32_t hex; uint8_t r, g, b, a; @@ -113,12 +119,12 @@ class plDebugText a = (uint8_t)( color.a * 255.0 ); hex = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); - DrawString( x, y, string, hex, style ); + DrawString_TEMP(x, y, string, hex, style); } - void DrawString( uint16_t x, uint16_t y, const char *string, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255, uint8_t style = 0 ) + void DrawString(uint16_t x, uint16_t y, const plString &string, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255, uint8_t style = 0) { - DrawString( x, y, string, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style ); + DrawString_TEMP(x, y, string, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style); } void SetDrawOnTopMode( bool enable ) { fDrawOnTopMode = enable; } @@ -138,7 +144,7 @@ class plDebugText void SetManager( plDebugTextManager *m ) { fManager = m; } void SetFont(const char *face, uint16_t size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } - const char *GetFontFace( void ) { return fFontFace; } + const char *GetFontFace( void ) { return fFontFace; } uint16_t GetFontSize( void ) { return fFontSize; } uint16_t GetFontHeight(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp index 593a75ee..5a5ca3ac 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp @@ -62,7 +62,7 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog plStatusLog* iLog = firstLog; while (iLog) { - width = hsMaximum(drawText.CalcStringWidth(iLog->GetFileName()) + 4, width); + width = hsMaximum(drawText.CalcStringWidth_TEMP(iLog->GetFileName().AsString()) + 4, width); iLog = iLog->fNext; numLogs++; } @@ -75,9 +75,9 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog while (iLog) { if (iLog == curLog) - drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName(), 0, 255, 0); + drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName().AsString(), 0, 255, 0); else - drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName()); + drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName().AsString()); iLog = iLog->fNext; yPos += height; @@ -110,7 +110,7 @@ void plStatusLogDrawer::Draw(plStatusLog* curLog, plStatusLog* firstLog) if( IGetFlags( curLog ) & plStatusLog::kFilledBackground ) drawText.DrawRect( x, y, x + width, y + height, 0, 0, 0, 127 ); - drawText.DrawString( x + 2, y + ( lineHt >> 1 ), IGetFilename( curLog ), 127, 127, 255, 255, plDebugText::kStyleBold ); + drawText.DrawString( x + 2, y + ( lineHt >> 1 ), IGetFilename( curLog ).AsString(), 127, 127, 255, 255, plDebugText::kStyleBold ); drawText.DrawRect( x + 2, y + ( lineHt << 1 ) + 1, x + width - 8, y + ( lineHt << 1 ) + 2, 127, 127, 255, 255 ); diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 20140b34..59b2e383 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -76,7 +76,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// plStatusLogMgr Stuff //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -wchar_t plStatusLogMgr::fBasePath[ MAX_PATH ] = L""; +plFileName plStatusLogMgr::IGetBasePath() +{ + static plFileName _basePath = plFileSystem::GetLogPath(); + return _basePath; +} //// Constructor & Destructor //////////////////////////////////////////////// @@ -86,9 +90,6 @@ plStatusLogMgr::plStatusLogMgr() fCurrDisplay = nil; fDrawer = nil; fLastLogChangeTime = 0; - - // Ensure the log path is created - plFileSystem::GetLogPath(); } plStatusLogMgr::~plStatusLogMgr() @@ -111,52 +112,6 @@ plStatusLogMgr &plStatusLogMgr::GetInstance( void ) return theManager; } -//// IEnsurePathExists /////////////////////////////////////////////////////// - -void plStatusLogMgr::IEnsurePathExists( const wchar_t *dirName ) -{ - // Note: this creates the directory if it doesn't exist, or if it does, - // returns false - plFileUtils::CreateDir( dirName ); -} - -//// IPathAppend ///////////////////////////////////////////////////////////// - -void plStatusLogMgr::IPathAppend( wchar_t *base, const wchar_t *extra, unsigned maxLen ) -{ - if (!base || !extra) - return; - - unsigned baseLen = wcslen(base); - unsigned extraLen = wcslen(extra); - - bool needsSeparator = false; - if (baseLen >= 1) - needsSeparator = (base[baseLen - 1] != PATH_SEPARATOR); - - if (needsSeparator) - { - if ((baseLen + 1 + 1) >= maxLen) - return; // abort, buffer isn't big enough - base[baseLen] = PATH_SEPARATOR; - ++baseLen; - base[baseLen] = '\0'; - } - - // concat the strings, making sure not to overrun the buffer - unsigned curExtraPos = 0; - for (unsigned curBasePos = baseLen; curBasePos < maxLen; ++curBasePos) - { - base[curBasePos] = extra[curExtraPos]; - if (extra[curExtraPos] == '\0') - break; // done - ++curExtraPos; - } - - // ensure we are null-terminated - base[maxLen - 1] = '\0'; -} - //// Draw //////////////////////////////////////////////////////////////////// void plStatusLogMgr::Draw( void ) @@ -174,24 +129,16 @@ void plStatusLogMgr::Draw( void ) //// CreateStatusLog ///////////////////////////////////////////////////////// -plStatusLog *plStatusLogMgr::CreateStatusLog( uint8_t numDisplayLines, const char *filename, uint32_t flags ) +plStatusLog *plStatusLogMgr::CreateStatusLog( uint8_t numDisplayLines, const plFileName &filename, uint32_t flags ) { - wchar_t* wFilename = hsStringToWString(filename); - plStatusLog* ret = CreateStatusLog(numDisplayLines, wFilename, flags); - delete [] wFilename; - return ret; -} - -plStatusLog *plStatusLogMgr::CreateStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ) -{ - IEnsurePathExists( fBasePath ); + plFileSystem::CreateDir(IGetBasePath(), true); plStatusLog *log = new plStatusLog( numDisplayLines, filename, flags ); // Put the new log in its alphabetical position plStatusLog** nextLog = &fDisplays; while (*nextLog) { - if (wcsicmp(filename, (*nextLog)->GetFileNameW()) <= 0) + if (filename.AsString().CompareI((*nextLog)->GetFileName().AsString()) <= 0) break; nextLog = &(*nextLog)->fNext; } @@ -216,14 +163,7 @@ void plStatusLogMgr::ToggleStatusLog( plStatusLog *logToDisplay ) //// SetCurrStatusLog //////////////////////////////////////////////////////// -void plStatusLogMgr::SetCurrStatusLog(const char* logName) -{ - wchar_t* wLogName = hsStringToWString(logName); - SetCurrStatusLog(wLogName); - delete [] wLogName; -} - -void plStatusLogMgr::SetCurrStatusLog(const wchar_t* logName) +void plStatusLogMgr::SetCurrStatusLog(const plFileName& logName) { plStatusLog* log = FindLog(logName, false); if (log != nil) @@ -264,21 +204,13 @@ void plStatusLogMgr::PrevStatusLog( void ) //// FindLog //////////////////////////////////////////////////////////////// -plStatusLog *plStatusLogMgr::FindLog( const char *filename, bool createIfNotFound ) -{ - wchar_t* wFilename = hsStringToWString(filename); - plStatusLog* ret = FindLog(wFilename, createIfNotFound); - delete [] wFilename; - return ret; -} - -plStatusLog *plStatusLogMgr::FindLog( const wchar_t *filename, bool createIfNotFound ) +plStatusLog *plStatusLogMgr::FindLog( const plFileName &filename, bool createIfNotFound ) { plStatusLog *log = fDisplays; while( log != nil ) { - if( wcsicmp( log->GetFileNameW(), filename ) == 0 ) + if (log->GetFileName().AsString().CompareI(filename.AsString()) == 0) return log; log = log->fNext; @@ -294,21 +226,6 @@ plStatusLog *plStatusLogMgr::FindLog( const wchar_t *filename, bool createIfNotF return log; } -//// SetBasePath //////////////////////////////////////////////////////////////// - -void plStatusLogMgr::SetBasePath( const char * path ) -{ - wchar_t* wPath = hsStringToWString(path); - SetBasePath(wPath); - delete [] wPath; -} - -void plStatusLogMgr::SetBasePath( const wchar_t * path ) -{ - wcscpy( fBasePath, path ); -} - - //// BounceLogs /////////////////////////////////////////////////////////////// void plStatusLogMgr::BounceLogs() @@ -325,34 +242,21 @@ void plStatusLogMgr::BounceLogs() //// DumpLogs //////////////////////////////////////////////////////////////// -bool plStatusLogMgr::DumpLogs( const char *newFolderName ) -{ - wchar_t* wFolderName = hsStringToWString(newFolderName); - bool ret = DumpLogs(wFolderName); - delete [] wFolderName; - return ret; -} - -bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName ) +bool plStatusLogMgr::DumpLogs( const plFileName &newFolderName ) { bool retVal = true; // assume success - // create root path and make sure it exists - wchar_t temp[MAX_PATH]; - std::wstring newPath = L""; - if (fBasePath) - { - wcsncpy(temp, fBasePath, MAX_PATH); - IPathAppend(temp, newFolderName, MAX_PATH); - newPath = temp; - } + plFileName newPath; + plFileName basePath = IGetBasePath(); + if (basePath.IsValid()) + newPath = plFileName::Join(basePath, newFolderName); else newPath = newFolderName; - IEnsurePathExists(newPath.c_str()); + plFileSystem::CreateDir(newPath, true); #if HS_BUILD_FOR_WIN32 hsWFolderIterator folderIterator; - if (fBasePath) - folderIterator.SetPath(fBasePath); + if (basePath.IsValid()) + folderIterator.SetPath(basePath.AsString().ToWchar()); else folderIterator.SetPath(L"."); @@ -361,24 +265,15 @@ bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName ) if (folderIterator.IsDirectory()) continue; - std::wstring baseFilename = folderIterator.GetFileName(); - std::wstring source; - if (fBasePath) - { - wcsncpy(temp, fBasePath, MAX_PATH); - IPathAppend(temp, baseFilename.c_str(), MAX_PATH); - source = temp; - } + plFileName baseFilename = plString::FromWchar(folderIterator.GetFileName()); + plFileName source; + if (basePath.IsValid()) + source = plFileName::Join(basePath, baseFilename); else source = baseFilename; - - std::wstring destination; - wcsncpy(temp, newPath.c_str(), MAX_PATH); - IPathAppend(temp, baseFilename.c_str(), MAX_PATH); - destination = temp; - bool succeeded = (CopyFileW(source.c_str(), destination.c_str(), FALSE) != 0); - retVal = retVal && succeeded; + plFileName destination = plFileName::Join(newPath, baseFilename); + retVal = (plFileSystem::Copy(source, destination) != 0); } #endif return retVal; @@ -390,7 +285,7 @@ bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName ) uint32_t plStatusLog::fLoggingOff = false; -plStatusLog::plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ) +plStatusLog::plStatusLog( uint8_t numDisplayLines, const plFileName &filename, uint32_t flags ) { fFileHandle = nil; fSema = nil; @@ -398,19 +293,14 @@ plStatusLog::plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint fForceLog = false; fMaxNumLines = numDisplayLines; - if( filename != nil ) + if (filename.IsValid()) { fFilename = filename; - char* temp = hsWStringToString(filename); - fCFilename = temp; - delete [] temp; - - fSema = new hsSemaphore(1, fCFilename.c_str()); + fSema = new hsSemaphore(1, fFilename.AsString().c_str()); } else { - fFilename = L""; - fCFilename = ""; + fFilename = ""; flags |= kDontWriteFile; fSema = new hsSemaphore(1); @@ -456,31 +346,29 @@ bool plStatusLog::IReOpen( void ) // Open the file, clearing it, if necessary if(!(fFlags & kDontWriteFile)) { - wchar_t file[ MAX_PATH ]; - wchar_t fileNoExt[MAX_PATH]; - wchar_t* ext=nil; - IParseFileName(file, MAX_PATH, fileNoExt, &ext); - wchar_t fileToOpen[MAX_PATH]; - hsSnwprintf(fileToOpen, MAX_PATH, L"%s.0%s", fileNoExt, ext); + plFileName fileNoExt; + plString ext; + IParseFileName(fileNoExt, ext); + plFileName fileToOpen = plString::Format("%s.0.%s", fileNoExt.AsString().c_str(), ext.c_str()); if (!(fFlags & kDontRotateLogs)) { - wchar_t work[MAX_PATH], work2[MAX_PATH]; - hsSnwprintf(work, MAX_PATH, L"%s.3%s",fileNoExt,ext); - plFileUtils::RemoveFile(work); - hsSnwprintf(work2, MAX_PATH, L"%s.2%s",fileNoExt,ext); - plFileUtils::FileMove(work2, work); - hsSnwprintf(work, MAX_PATH, L"%s.1%s",fileNoExt,ext); - plFileUtils::FileMove(work, work2); - plFileUtils::FileMove(fileToOpen, work); + plFileName work, work2; + work = plString::Format("%s.3.%s", fileNoExt.AsString().c_str(), ext.c_str()); + plFileSystem::Unlink(work); + work2 = plString::Format("%s.2.%s", fileNoExt.AsString().c_str(), ext.c_str()); + plFileSystem::Move(work2, work); + work = plString::Format("%s.1.%s", fileNoExt.AsString().c_str(), ext.c_str()); + plFileSystem::Move(work, work2); + plFileSystem::Move(fileToOpen, work); } if (fFlags & kAppendToLast) { - fFileHandle = hsWFopen( fileToOpen, L"at" ); + fFileHandle = plFileSystem::Open(fileToOpen, "at"); } else { - fFileHandle = hsWFopen( fileToOpen, L"wt" ); + fFileHandle = plFileSystem::Open(fileToOpen, "wt"); // if we need to reopen lets just append fFlags |= kAppendToLast; } @@ -520,31 +408,20 @@ void plStatusLog::IFini( void ) delete [] fColors; } -void plStatusLog::IParseFileName(wchar_t* file, size_t fnsize, wchar_t* fileNoExt, wchar_t** ext) const +void plStatusLog::IParseFileName(plFileName& fileNoExt, plString& ext) const { - const wchar_t *base = plStatusLogMgr::IGetBasePath(); - if( wcslen( base ) != nil ) - hsSnwprintf( file, fnsize, L"%s%S%s", base, PATH_SEPARATOR_STR, fFilename.c_str() ); + plFileName base = plStatusLogMgr::IGetBasePath(); + plFileName file; + if (base.IsValid()) + file = plFileName::Join(base, fFilename); else - wcscpy( file, fFilename.c_str() ); + file = fFilename; + + plFileSystem::CreateDir(file.StripFileName(), true); - plFileUtils::EnsureFilePathExists( file ); - // apache-style file backup - - *ext = wcsrchr(file, L'.'); - if (*ext) - { - int fileLen = *ext - file; - wcsncpy(fileNoExt, file, fileLen); - fileNoExt[fileLen] = L'\0'; - } - else - { - wcscpy(fileNoExt, file); - *ext = L'\0'; - } - + fileNoExt = file.StripFileExt(); + ext = file.GetFileExt(); } //// IUnlink ///////////////////////////////////////////////////////////////// @@ -703,7 +580,7 @@ bool plStatusLog::AddLineF( uint32_t color, const char *format, ... ) //// AddLine Static Variations /////////////////////////////////////////////// -bool plStatusLog::AddLineS( const char *filename, const char *format, ... ) +bool plStatusLog::AddLineS( const plFileName &filename, const char *format, ... ) { plStatusLog *log = plStatusLogMgr::GetInstance().FindLog( filename ); if (!log) @@ -718,7 +595,7 @@ bool plStatusLog::AddLineS( const char *filename, const char *format, ... ) return log->AddLineV( format, arguments ); } -bool plStatusLog::AddLineS( const char *filename, uint32_t color, const char *format, ... ) +bool plStatusLog::AddLineS( const plFileName &filename, uint32_t color, const char *format, ... ) { plStatusLog *log = plStatusLogMgr::GetInstance().FindLog( filename ); if (!log) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h index e84c4828..ef8635ba 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h @@ -58,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "hsThread.h" +#include "plFileSystem.h" #include @@ -83,8 +84,7 @@ class plStatusLog uint32_t fOrigFlags; uint32_t fMaxNumLines; - std::string fCFilename; // used ONLY by GetFileName() - std::wstring fFilename; + plFileName fFilename; char** fLines; uint32_t* fColors; hsSemaphore* fSema; @@ -101,13 +101,13 @@ class plStatusLog bool IAddLine( const char *line, int32_t count, uint32_t color ); bool IPrintLineToFile( const char *line, uint32_t count ); - void IParseFileName(wchar_t* file, size_t fnsize, wchar_t* fileNoExt, wchar_t** ext) const; + void IParseFileName(plFileName &fileNoExt, plString &ext) const; void IInit( void ); void IFini( void ); bool IReOpen( void ); - plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ); + plStatusLog( uint8_t numDisplayLines, const plFileName &filename, uint32_t flags ); public: @@ -170,16 +170,15 @@ class plStatusLog /// Static functions that you give a filename to and it searches for a log based on that /// (or creates one if it isn't available) - static bool AddLineS( const char *filename, const char *format, ... ); - static bool AddLineS( const char *filename, uint32_t color, const char *format, ... ); + static bool AddLineS( const plFileName &filename, const char *format, ... ); + static bool AddLineS( const plFileName &filename, uint32_t color, const char *format, ... ); void Clear( void ); // Clear and open a new file. void Bounce( uint32_t flags=0 ); - const char* GetFileName() const {return fCFilename.c_str();} - const wchar_t* GetFileNameW() const {return fFilename.c_str();} + const plFileName &GetFileName() const { return fFilename; } void SetForceLog(bool force) { fForceLog = force; } }; @@ -205,12 +204,7 @@ class plStatusLogMgr double fLastLogChangeTime; - static wchar_t fBasePath[]; - - static const wchar_t *IGetBasePath( void ) { return fBasePath; } - - void IEnsurePathExists( const wchar_t *dirName ); - void IPathAppend( wchar_t *base, const wchar_t *extra, unsigned maxLen ); + static plFileName IGetBasePath(); hsMutex fMutex; // To make multithreaded-safe @@ -227,25 +221,19 @@ class plStatusLogMgr void Draw( void ); - plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const char *filename, uint32_t flags = plStatusLog::kFilledBackground ); - plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags = plStatusLog::kFilledBackground ); + plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const plFileName &filename, uint32_t flags = plStatusLog::kFilledBackground ); void ToggleStatusLog( plStatusLog *logToDisplay ); void NextStatusLog( void ); void PrevStatusLog( void ); - void SetCurrStatusLog( const char *logName ); - void SetCurrStatusLog( const wchar_t *logName ); - plStatusLog *FindLog( const char *filename, bool createIfNotFound = true ); - plStatusLog *FindLog( const wchar_t *filename, bool createIfNotFound = true ); + void SetCurrStatusLog( const plFileName &logName ); + plStatusLog *FindLog( const plFileName &filename, bool createIfNotFound = true ); void SetDrawer( plStatusLogDrawerStub *drawer ) { fDrawer = drawer; } - void SetBasePath( const char * path ); - void SetBasePath( const wchar_t * path ); void BounceLogs(); // Create a new folder and copy all log files into it (returns false on failure) - bool DumpLogs( const char *newFolderName ); - bool DumpLogs( const wchar_t *newFolderName ); + bool DumpLogs( const plFileName &newFolderName ); }; //// plStatusLogDrawerStub Class //////////////////////////////////////////// @@ -261,9 +249,8 @@ class plStatusLogDrawerStub uint32_t IGetMaxNumLines( plStatusLog *log ) const { return log->fMaxNumLines; } char **IGetLines( plStatusLog *log ) const { return log->fLines; } - const char *IGetFilename( plStatusLog *log ) const { return log->GetFileName(); } - const wchar_t *IGetFilenameW( plStatusLog *log ) const { return log->GetFileNameW(); } - uint32_t *IGetColors( plStatusLog *log ) const { return log->fColors; } + plFileName IGetFilename( plStatusLog *log ) const { return log->GetFileName(); } + uint32_t *IGetColors( plStatusLog *log ) const { return log->fColors; } uint32_t IGetFlags( plStatusLog *log ) const { return log->fFlags; } public: diff --git a/Sources/Tools/MaxConvert/plMeshConverter.cpp b/Sources/Tools/MaxConvert/plMeshConverter.cpp index d87cb724..d0375131 100644 --- a/Sources/Tools/MaxConvert/plMeshConverter.cpp +++ b/Sources/Tools/MaxConvert/plMeshConverter.cpp @@ -494,11 +494,8 @@ bool plMeshConverter::IValidateUVs(plMaxNode* node) if (uvsAreBad) { - TSTR logfile = "UV_"; - logfile += GetCOREInterface()->GetCurFileName(); - logfile += ".log"; + plFileName logfile = plString::Format("UV_%s.log", GetCOREInterface()->GetCurFileName().data()); plStatusLog::AddLineS(logfile, "%s has suspicious UVs", node->GetName()); - if (fWarnSuspiciousUVs) {