Browse Source

Add plStatusLog to the list of converted interface, in order to fix my log output dir screw-up

Michael Hansen 12 years ago
parent
commit
1ce553ac80
  1. 4
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  2. 20
      Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h
  3. 8
      Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp
  4. 233
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp
  5. 41
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h
  6. 5
      Sources/Tools/MaxConvert/plMeshConverter.cpp

4
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" ) 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<const char *>(params[0]));
} }
#endif // LIMIT_CONSOLE_COMMANDS #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" ) 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<const char *>(params[0]));
} }

20
Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h

@ -97,11 +97,17 @@ class plDebugText
static plDebugText &Instance( void ) { return fInstance; } 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; uint32_t hex;
uint8_t r, g, b, a; uint8_t r, g, b, a;
@ -113,12 +119,12 @@ class plDebugText
a = (uint8_t)( color.a * 255.0 ); a = (uint8_t)( color.a * 255.0 );
hex = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); 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; } void SetDrawOnTopMode( bool enable ) { fDrawOnTopMode = enable; }
@ -138,7 +144,7 @@ class plDebugText
void SetManager( plDebugTextManager *m ) { fManager = m; } void SetManager( plDebugTextManager *m ) { fManager = m; }
void SetFont(const char *face, uint16_t size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } 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 GetFontSize( void ) { return fFontSize; }
uint16_t GetFontHeight(); uint16_t GetFontHeight();

8
Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp

@ -62,7 +62,7 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog
plStatusLog* iLog = firstLog; plStatusLog* iLog = firstLog;
while (iLog) while (iLog)
{ {
width = hsMaximum(drawText.CalcStringWidth(iLog->GetFileName()) + 4, width); width = hsMaximum(drawText.CalcStringWidth_TEMP(iLog->GetFileName().AsString()) + 4, width);
iLog = iLog->fNext; iLog = iLog->fNext;
numLogs++; numLogs++;
} }
@ -75,9 +75,9 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog
while (iLog) while (iLog)
{ {
if (iLog == curLog) 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 else
drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName()); drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName().AsString());
iLog = iLog->fNext; iLog = iLog->fNext;
yPos += height; yPos += height;
@ -110,7 +110,7 @@ void plStatusLogDrawer::Draw(plStatusLog* curLog, plStatusLog* firstLog)
if( IGetFlags( curLog ) & plStatusLog::kFilledBackground ) if( IGetFlags( curLog ) & plStatusLog::kFilledBackground )
drawText.DrawRect( x, y, x + width, y + height, 0, 0, 0, 127 ); 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, drawText.DrawRect( x + 2, y + ( lineHt << 1 ) + 1,
x + width - 8, y + ( lineHt << 1 ) + 2, 127, 127, 255, 255 ); x + width - 8, y + ( lineHt << 1 ) + 2, 127, 127, 255, 255 );

233
Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp

@ -76,7 +76,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// plStatusLogMgr Stuff //////////////////////////////////////////////////// //// plStatusLogMgr Stuff ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
wchar_t plStatusLogMgr::fBasePath[ MAX_PATH ] = L""; plFileName plStatusLogMgr::IGetBasePath()
{
static plFileName _basePath = plFileSystem::GetLogPath();
return _basePath;
}
//// Constructor & Destructor //////////////////////////////////////////////// //// Constructor & Destructor ////////////////////////////////////////////////
@ -86,9 +90,6 @@ plStatusLogMgr::plStatusLogMgr()
fCurrDisplay = nil; fCurrDisplay = nil;
fDrawer = nil; fDrawer = nil;
fLastLogChangeTime = 0; fLastLogChangeTime = 0;
// Ensure the log path is created
plFileSystem::GetLogPath();
} }
plStatusLogMgr::~plStatusLogMgr() plStatusLogMgr::~plStatusLogMgr()
@ -111,52 +112,6 @@ plStatusLogMgr &plStatusLogMgr::GetInstance( void )
return theManager; 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 //////////////////////////////////////////////////////////////////// //// Draw ////////////////////////////////////////////////////////////////////
void plStatusLogMgr::Draw( void ) void plStatusLogMgr::Draw( void )
@ -174,24 +129,16 @@ void plStatusLogMgr::Draw( void )
//// CreateStatusLog ///////////////////////////////////////////////////////// //// 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); plFileSystem::CreateDir(IGetBasePath(), true);
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 );
plStatusLog *log = new plStatusLog( numDisplayLines, filename, flags ); plStatusLog *log = new plStatusLog( numDisplayLines, filename, flags );
// Put the new log in its alphabetical position // Put the new log in its alphabetical position
plStatusLog** nextLog = &fDisplays; plStatusLog** nextLog = &fDisplays;
while (*nextLog) while (*nextLog)
{ {
if (wcsicmp(filename, (*nextLog)->GetFileNameW()) <= 0) if (filename.AsString().CompareI((*nextLog)->GetFileName().AsString()) <= 0)
break; break;
nextLog = &(*nextLog)->fNext; nextLog = &(*nextLog)->fNext;
} }
@ -216,14 +163,7 @@ void plStatusLogMgr::ToggleStatusLog( plStatusLog *logToDisplay )
//// SetCurrStatusLog //////////////////////////////////////////////////////// //// SetCurrStatusLog ////////////////////////////////////////////////////////
void plStatusLogMgr::SetCurrStatusLog(const char* logName) void plStatusLogMgr::SetCurrStatusLog(const plFileName& logName)
{
wchar_t* wLogName = hsStringToWString(logName);
SetCurrStatusLog(wLogName);
delete [] wLogName;
}
void plStatusLogMgr::SetCurrStatusLog(const wchar_t* logName)
{ {
plStatusLog* log = FindLog(logName, false); plStatusLog* log = FindLog(logName, false);
if (log != nil) if (log != nil)
@ -264,21 +204,13 @@ void plStatusLogMgr::PrevStatusLog( void )
//// FindLog //////////////////////////////////////////////////////////////// //// FindLog ////////////////////////////////////////////////////////////////
plStatusLog *plStatusLogMgr::FindLog( const char *filename, bool createIfNotFound ) plStatusLog *plStatusLogMgr::FindLog( const plFileName &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 *log = fDisplays; plStatusLog *log = fDisplays;
while( log != nil ) while( log != nil )
{ {
if( wcsicmp( log->GetFileNameW(), filename ) == 0 ) if (log->GetFileName().AsString().CompareI(filename.AsString()) == 0)
return log; return log;
log = log->fNext; log = log->fNext;
@ -294,21 +226,6 @@ plStatusLog *plStatusLogMgr::FindLog( const wchar_t *filename, bool createIfNotF
return log; 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 /////////////////////////////////////////////////////////////// //// BounceLogs ///////////////////////////////////////////////////////////////
void plStatusLogMgr::BounceLogs() void plStatusLogMgr::BounceLogs()
@ -325,34 +242,21 @@ void plStatusLogMgr::BounceLogs()
//// DumpLogs //////////////////////////////////////////////////////////////// //// DumpLogs ////////////////////////////////////////////////////////////////
bool plStatusLogMgr::DumpLogs( const char *newFolderName ) bool plStatusLogMgr::DumpLogs( const plFileName &newFolderName )
{
wchar_t* wFolderName = hsStringToWString(newFolderName);
bool ret = DumpLogs(wFolderName);
delete [] wFolderName;
return ret;
}
bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName )
{ {
bool retVal = true; // assume success bool retVal = true; // assume success
// create root path and make sure it exists plFileName newPath;
wchar_t temp[MAX_PATH]; plFileName basePath = IGetBasePath();
std::wstring newPath = L""; if (basePath.IsValid())
if (fBasePath) newPath = plFileName::Join(basePath, newFolderName);
{
wcsncpy(temp, fBasePath, MAX_PATH);
IPathAppend(temp, newFolderName, MAX_PATH);
newPath = temp;
}
else else
newPath = newFolderName; newPath = newFolderName;
IEnsurePathExists(newPath.c_str()); plFileSystem::CreateDir(newPath, true);
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
hsWFolderIterator folderIterator; hsWFolderIterator folderIterator;
if (fBasePath) if (basePath.IsValid())
folderIterator.SetPath(fBasePath); folderIterator.SetPath(basePath.AsString().ToWchar());
else else
folderIterator.SetPath(L"."); folderIterator.SetPath(L".");
@ -361,24 +265,15 @@ bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName )
if (folderIterator.IsDirectory()) if (folderIterator.IsDirectory())
continue; continue;
std::wstring baseFilename = folderIterator.GetFileName(); plFileName baseFilename = plString::FromWchar(folderIterator.GetFileName());
std::wstring source; plFileName source;
if (fBasePath) if (basePath.IsValid())
{ source = plFileName::Join(basePath, baseFilename);
wcsncpy(temp, fBasePath, MAX_PATH);
IPathAppend(temp, baseFilename.c_str(), MAX_PATH);
source = temp;
}
else else
source = baseFilename; 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); plFileName destination = plFileName::Join(newPath, baseFilename);
retVal = retVal && succeeded; retVal = (plFileSystem::Copy(source, destination) != 0);
} }
#endif #endif
return retVal; return retVal;
@ -390,7 +285,7 @@ bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName )
uint32_t plStatusLog::fLoggingOff = false; 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; fFileHandle = nil;
fSema = nil; fSema = nil;
@ -398,19 +293,14 @@ plStatusLog::plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint
fForceLog = false; fForceLog = false;
fMaxNumLines = numDisplayLines; fMaxNumLines = numDisplayLines;
if( filename != nil ) if (filename.IsValid())
{ {
fFilename = filename; fFilename = filename;
char* temp = hsWStringToString(filename); fSema = new hsSemaphore(1, fFilename.AsString().c_str());
fCFilename = temp;
delete [] temp;
fSema = new hsSemaphore(1, fCFilename.c_str());
} }
else else
{ {
fFilename = L""; fFilename = "";
fCFilename = "";
flags |= kDontWriteFile; flags |= kDontWriteFile;
fSema = new hsSemaphore(1); fSema = new hsSemaphore(1);
@ -456,31 +346,29 @@ bool plStatusLog::IReOpen( void )
// Open the file, clearing it, if necessary // Open the file, clearing it, if necessary
if(!(fFlags & kDontWriteFile)) if(!(fFlags & kDontWriteFile))
{ {
wchar_t file[ MAX_PATH ]; plFileName fileNoExt;
wchar_t fileNoExt[MAX_PATH]; plString ext;
wchar_t* ext=nil; IParseFileName(fileNoExt, ext);
IParseFileName(file, MAX_PATH, fileNoExt, &ext); plFileName fileToOpen = plString::Format("%s.0.%s", fileNoExt.AsString().c_str(), ext.c_str());
wchar_t fileToOpen[MAX_PATH];
hsSnwprintf(fileToOpen, MAX_PATH, L"%s.0%s", fileNoExt, ext);
if (!(fFlags & kDontRotateLogs)) if (!(fFlags & kDontRotateLogs))
{ {
wchar_t work[MAX_PATH], work2[MAX_PATH]; plFileName work, work2;
hsSnwprintf(work, MAX_PATH, L"%s.3%s",fileNoExt,ext); work = plString::Format("%s.3.%s", fileNoExt.AsString().c_str(), ext.c_str());
plFileUtils::RemoveFile(work); plFileSystem::Unlink(work);
hsSnwprintf(work2, MAX_PATH, L"%s.2%s",fileNoExt,ext); work2 = plString::Format("%s.2.%s", fileNoExt.AsString().c_str(), ext.c_str());
plFileUtils::FileMove(work2, work); plFileSystem::Move(work2, work);
hsSnwprintf(work, MAX_PATH, L"%s.1%s",fileNoExt,ext); work = plString::Format("%s.1.%s", fileNoExt.AsString().c_str(), ext.c_str());
plFileUtils::FileMove(work, work2); plFileSystem::Move(work, work2);
plFileUtils::FileMove(fileToOpen, work); plFileSystem::Move(fileToOpen, work);
} }
if (fFlags & kAppendToLast) if (fFlags & kAppendToLast)
{ {
fFileHandle = hsWFopen( fileToOpen, L"at" ); fFileHandle = plFileSystem::Open(fileToOpen, "at");
} }
else else
{ {
fFileHandle = hsWFopen( fileToOpen, L"wt" ); fFileHandle = plFileSystem::Open(fileToOpen, "wt");
// if we need to reopen lets just append // if we need to reopen lets just append
fFlags |= kAppendToLast; fFlags |= kAppendToLast;
} }
@ -520,31 +408,20 @@ void plStatusLog::IFini( void )
delete [] fColors; 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(); plFileName base = plStatusLogMgr::IGetBasePath();
if( wcslen( base ) != nil ) plFileName file;
hsSnwprintf( file, fnsize, L"%s%S%s", base, PATH_SEPARATOR_STR, fFilename.c_str() ); if (base.IsValid())
file = plFileName::Join(base, fFilename);
else else
wcscpy( file, fFilename.c_str() ); file = fFilename;
plFileSystem::CreateDir(file.StripFileName(), true);
plFileUtils::EnsureFilePathExists( file );
// apache-style file backup // apache-style file backup
fileNoExt = file.StripFileExt();
*ext = wcsrchr(file, L'.'); ext = file.GetFileExt();
if (*ext)
{
int fileLen = *ext - file;
wcsncpy(fileNoExt, file, fileLen);
fileNoExt[fileLen] = L'\0';
}
else
{
wcscpy(fileNoExt, file);
*ext = L'\0';
}
} }
//// IUnlink ///////////////////////////////////////////////////////////////// //// IUnlink /////////////////////////////////////////////////////////////////
@ -703,7 +580,7 @@ bool plStatusLog::AddLineF( uint32_t color, const char *format, ... )
//// AddLine Static Variations /////////////////////////////////////////////// //// 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 ); plStatusLog *log = plStatusLogMgr::GetInstance().FindLog( filename );
if (!log) if (!log)
@ -718,7 +595,7 @@ bool plStatusLog::AddLineS( const char *filename, const char *format, ... )
return log->AddLineV( format, arguments ); 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 ); plStatusLog *log = plStatusLogMgr::GetInstance().FindLog( filename );
if (!log) if (!log)

41
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 "HeadSpin.h"
#include "hsThread.h" #include "hsThread.h"
#include "plFileSystem.h"
#include <string> #include <string>
@ -83,8 +84,7 @@ class plStatusLog
uint32_t fOrigFlags; uint32_t fOrigFlags;
uint32_t fMaxNumLines; uint32_t fMaxNumLines;
std::string fCFilename; // used ONLY by GetFileName() plFileName fFilename;
std::wstring fFilename;
char** fLines; char** fLines;
uint32_t* fColors; uint32_t* fColors;
hsSemaphore* fSema; hsSemaphore* fSema;
@ -101,13 +101,13 @@ class plStatusLog
bool IAddLine( const char *line, int32_t count, uint32_t color ); bool IAddLine( const char *line, int32_t count, uint32_t color );
bool IPrintLineToFile( const char *line, uint32_t count ); 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 IInit( void );
void IFini( void ); void IFini( void );
bool IReOpen( 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: public:
@ -170,16 +170,15 @@ class plStatusLog
/// Static functions that you give a filename to and it searches for a log based on that /// 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) /// (or creates one if it isn't available)
static bool AddLineS( const char *filename, const char *format, ... ); static bool AddLineS( const plFileName &filename, const char *format, ... );
static bool AddLineS( const char *filename, uint32_t color, const char *format, ... ); static bool AddLineS( const plFileName &filename, uint32_t color, const char *format, ... );
void Clear( void ); void Clear( void );
// Clear and open a new file. // Clear and open a new file.
void Bounce( uint32_t flags=0 ); void Bounce( uint32_t flags=0 );
const char* GetFileName() const {return fCFilename.c_str();} const plFileName &GetFileName() const { return fFilename; }
const wchar_t* GetFileNameW() const {return fFilename.c_str();}
void SetForceLog(bool force) { fForceLog = force; } void SetForceLog(bool force) { fForceLog = force; }
}; };
@ -205,12 +204,7 @@ class plStatusLogMgr
double fLastLogChangeTime; double fLastLogChangeTime;
static wchar_t fBasePath[]; static plFileName IGetBasePath();
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 );
hsMutex fMutex; // To make multithreaded-safe hsMutex fMutex; // To make multithreaded-safe
@ -227,25 +221,19 @@ class plStatusLogMgr
void Draw( void ); void Draw( void );
plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const char *filename, uint32_t flags = plStatusLog::kFilledBackground ); plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const plFileName &filename, uint32_t flags = plStatusLog::kFilledBackground );
plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags = plStatusLog::kFilledBackground );
void ToggleStatusLog( plStatusLog *logToDisplay ); void ToggleStatusLog( plStatusLog *logToDisplay );
void NextStatusLog( void ); void NextStatusLog( void );
void PrevStatusLog( void ); void PrevStatusLog( void );
void SetCurrStatusLog( const char *logName ); void SetCurrStatusLog( const plFileName &logName );
void SetCurrStatusLog( const wchar_t *logName ); plStatusLog *FindLog( const plFileName &filename, bool createIfNotFound = true );
plStatusLog *FindLog( const char *filename, bool createIfNotFound = true );
plStatusLog *FindLog( const wchar_t *filename, bool createIfNotFound = true );
void SetDrawer( plStatusLogDrawerStub *drawer ) { fDrawer = drawer; } void SetDrawer( plStatusLogDrawerStub *drawer ) { fDrawer = drawer; }
void SetBasePath( const char * path );
void SetBasePath( const wchar_t * path );
void BounceLogs(); void BounceLogs();
// Create a new folder and copy all log files into it (returns false on failure) // Create a new folder and copy all log files into it (returns false on failure)
bool DumpLogs( const char *newFolderName ); bool DumpLogs( const plFileName &newFolderName );
bool DumpLogs( const wchar_t *newFolderName );
}; };
//// plStatusLogDrawerStub Class //////////////////////////////////////////// //// plStatusLogDrawerStub Class ////////////////////////////////////////////
@ -261,9 +249,8 @@ class plStatusLogDrawerStub
uint32_t IGetMaxNumLines( plStatusLog *log ) const { return log->fMaxNumLines; } uint32_t IGetMaxNumLines( plStatusLog *log ) const { return log->fMaxNumLines; }
char **IGetLines( plStatusLog *log ) const { return log->fLines; } char **IGetLines( plStatusLog *log ) const { return log->fLines; }
const char *IGetFilename( plStatusLog *log ) const { return log->GetFileName(); } plFileName 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; }
uint32_t *IGetColors( plStatusLog *log ) const { return log->fColors; }
uint32_t IGetFlags( plStatusLog *log ) const { return log->fFlags; } uint32_t IGetFlags( plStatusLog *log ) const { return log->fFlags; }
public: public:

5
Sources/Tools/MaxConvert/plMeshConverter.cpp

@ -494,11 +494,8 @@ bool plMeshConverter::IValidateUVs(plMaxNode* node)
if (uvsAreBad) if (uvsAreBad)
{ {
TSTR logfile = "UV_"; plFileName logfile = plString::Format("UV_%s.log", GetCOREInterface()->GetCurFileName().data());
logfile += GetCOREInterface()->GetCurFileName();
logfile += ".log";
plStatusLog::AddLineS(logfile, "%s has suspicious UVs", node->GetName()); plStatusLog::AddLineS(logfile, "%s has suspicious UVs", node->GetName());
if (fWarnSuspiciousUVs) if (fWarnSuspiciousUVs)
{ {

Loading…
Cancel
Save