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