Sort out a valgrind issue w/ handling TEMPDIRECTORY paths. Clean up formatting in twcmdline's FillOutConfigInfo().
This commit is contained in:
parent
92580983ec
commit
236d67b941
|
@ -256,17 +256,29 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
{
|
{
|
||||||
TSTRING str;
|
TSTRING str;
|
||||||
if(cf.Lookup(TSTRING(_T("POLFILE")), str))
|
if(cf.Lookup(TSTRING(_T("POLFILE")), str))
|
||||||
|
{
|
||||||
pModeInfo->mPolFile = str;
|
pModeInfo->mPolFile = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("DBFILE")), str))
|
if(cf.Lookup(TSTRING(_T("DBFILE")), str))
|
||||||
|
{
|
||||||
pModeInfo->mDbFile = str;
|
pModeInfo->mDbFile = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str))
|
if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str))
|
||||||
|
{
|
||||||
pModeInfo->mSiteKeyFile = str;
|
pModeInfo->mSiteKeyFile = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str))
|
if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str))
|
||||||
|
{
|
||||||
pModeInfo->mLocalKeyFile = str;
|
pModeInfo->mLocalKeyFile = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("REPORTFILE")), str))
|
if(cf.Lookup(TSTRING(_T("REPORTFILE")), str))
|
||||||
|
{
|
||||||
pModeInfo->mReportFile = str;
|
pModeInfo->mReportFile = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("EDITOR")), str))
|
if(cf.Lookup(TSTRING(_T("EDITOR")), str))
|
||||||
|
{
|
||||||
pModeInfo->mEditor = str;
|
pModeInfo->mEditor = str;
|
||||||
|
}
|
||||||
if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str))
|
if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str))
|
||||||
{
|
{
|
||||||
if (_tcsicmp(str.c_str(), _T("true")) == 0)
|
if (_tcsicmp(str.c_str(), _T("true")) == 0)
|
||||||
|
@ -288,7 +300,8 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
TSTRING temp_directory;
|
TSTRING temp_directory;
|
||||||
cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory);
|
cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory);
|
||||||
|
|
||||||
if (temp_directory.length() == 0) {
|
if (temp_directory.empty())
|
||||||
|
{
|
||||||
#if IS_AROS
|
#if IS_AROS
|
||||||
temp_directory = "T:";
|
temp_directory = "T:";
|
||||||
#else
|
#else
|
||||||
|
@ -298,8 +311,9 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
|
|
||||||
// make sure we have a trailing slash -- thanks Jarno...
|
// make sure we have a trailing slash -- thanks Jarno...
|
||||||
//
|
//
|
||||||
if (temp_directory[_tcslen(str.c_str())-1] != '/') {
|
if (temp_directory.back() != '/')
|
||||||
temp_directory += '/';
|
{
|
||||||
|
temp_directory.push_back('/');
|
||||||
}
|
}
|
||||||
// make sure it exists...
|
// make sure it exists...
|
||||||
//
|
//
|
||||||
|
@ -308,20 +322,22 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
temp_directory = cDevicePath::AsNative(temp_directory);
|
temp_directory = cDevicePath::AsNative(temp_directory);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (access(temp_directory.c_str(), F_OK) != 0) {
|
if (access(temp_directory.c_str(), F_OK) != 0)
|
||||||
|
{
|
||||||
TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY );
|
TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY );
|
||||||
TSTRING tmpStr = _T("Directory: ");
|
TSTRING tmpStr = _T("Directory: ");
|
||||||
tmpStr += (temp_directory + _T("\n"));
|
tmpStr += (temp_directory + _T("\n"));
|
||||||
tmpStr += errStr;
|
tmpStr += errStr;
|
||||||
throw eTWInvalidTempDirectory(tmpStr);
|
throw eTWInvalidTempDirectory(tmpStr);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
iFSServices::GetInstance()->SetTempDirName(temp_directory);
|
iFSServices::GetInstance()->SetTempDirName(temp_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) {
|
if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str))
|
||||||
|
{
|
||||||
if (str.length() != 0)
|
if (str.length() != 0)
|
||||||
pModeInfo->mGlobalEmail = str;
|
pModeInfo->mGlobalEmail = str;
|
||||||
}
|
}
|
||||||
|
@ -351,9 +367,10 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
// no level was specified in the configuration file, use default.
|
// no level was specified in the configuration file, use default.
|
||||||
pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT;
|
pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT;
|
||||||
|
}
|
||||||
|
|
||||||
// Decide what mail method should be used to email reports
|
// Decide what mail method should be used to email reports
|
||||||
if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str))
|
if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str))
|
||||||
|
@ -377,9 +394,13 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
|
|
||||||
// Get the SMTP server
|
// Get the SMTP server
|
||||||
if(cf.Lookup(TSTRING(_T("SMTPHOST")), str))
|
if(cf.Lookup(TSTRING(_T("SMTPHOST")), str))
|
||||||
|
{
|
||||||
pModeInfo->mSmtpHost = str;
|
pModeInfo->mSmtpHost = str;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default
|
pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default
|
||||||
|
}
|
||||||
|
|
||||||
// Get the SMTP port number
|
// Get the SMTP port number
|
||||||
if(cf.Lookup(TSTRING(_T("SMTPPORT")), str))
|
if(cf.Lookup(TSTRING(_T("SMTPPORT")), str))
|
||||||
|
@ -390,13 +411,19 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
pModeInfo->mSmtpPort = static_cast<unsigned short>( i );
|
pModeInfo->mSmtpPort = static_cast<unsigned short>( i );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pModeInfo->mSmtpPort = 25; // this is the default
|
pModeInfo->mSmtpPort = 25; // this is the default
|
||||||
|
}
|
||||||
|
|
||||||
// Get the mail program to use if we're piping our email
|
// Get the mail program to use if we're piping our email
|
||||||
if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str))
|
if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str))
|
||||||
|
{
|
||||||
pModeInfo->mMailProgram = str;
|
pModeInfo->mMailProgram = str;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified
|
pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified
|
||||||
|
}
|
||||||
|
|
||||||
// Get the mail program to use if we're piping our email
|
// Get the mail program to use if we're piping our email
|
||||||
if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str))
|
if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str))
|
||||||
|
@ -407,10 +434,14 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
pModeInfo->mMailNoViolations = false;
|
pModeInfo->mMailNoViolations = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified
|
pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified
|
||||||
|
}
|
||||||
|
|
||||||
if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str))
|
if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str))
|
||||||
|
{
|
||||||
pModeInfo->mMailFrom = str;
|
pModeInfo->mMailFrom = str;
|
||||||
|
}
|
||||||
|
|
||||||
// SYSLOG reporting
|
// SYSLOG reporting
|
||||||
if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str))
|
if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str))
|
||||||
|
@ -425,7 +456,9 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pModeInfo->mbLogToSyslog = false;
|
pModeInfo->mbLogToSyslog = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Crossing file systems
|
// Crossing file systems
|
||||||
if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str))
|
if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str))
|
||||||
|
|
Loading…
Reference in New Issue