|
|
@ -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); |
|
|
|
|
|
|
|
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 ); |
|
|
|
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; |
|
|
|
plFileName destination = plFileName::Join(newPath, baseFilename); |
|
|
|
wcsncpy(temp, newPath.c_str(), MAX_PATH); |
|
|
|
retVal = (plFileSystem::Copy(source, destination) != 0); |
|
|
|
IPathAppend(temp, baseFilename.c_str(), MAX_PATH); |
|
|
|
|
|
|
|
destination = temp; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool succeeded = (CopyFileW(source.c_str(), destination.c_str(), FALSE) != 0); |
|
|
|
|
|
|
|
retVal = retVal && succeeded; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#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; |
|
|
|
|
|
|
|
|
|
|
|
plFileUtils::EnsureFilePathExists( file ); |
|
|
|
plFileSystem::CreateDir(file.StripFileName(), true); |
|
|
|
|
|
|
|
|
|
|
|
// 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) |
|
|
|