Пример #1
0
bool KStringManager::loadAll(const char* path)
{
	JG_F::KDirectory dir;
	JG_F::KDirectory::FileList files;
	if(!dir.Open(path)) return false;
	if(!dir.ListFile(files)) return false;
	
	KLanguage language;
	int n = files.size();
	for(int i=0; i<n; i++)
	{
		JG_F::KFileData& fdata = files[i];
		if(!fdata.IsDir()) continue;
		int lang = language.languageFromName(fdata.m_shortName);
		if(!lang) continue;
		char filename[512];
		sprintf(filename, "%s%c%s%cList.txt", path, PATH_SEPERATOR, fdata.m_shortName, PATH_SEPERATOR);
		this->loadFileList(lang, filename);
	}

	return true;
}
Пример #2
0
BOOL KStringManager::InitIllegalWords(const char* filename)
{
	char path[512];

	if(!JG_F::KFileUtil::IsDir(filename))
		return this->_loadIllegalWords(m_language, filename);

	int lang = this->_getLangFromFilename(filename);
	if(!lang)
	{
		sprintf_k(path, sizeof(path), "%s%cIllegalChars.txt", filename, PATH_SEPERATOR);
		if(JG_F::KFileUtil::IsFileExists(path))
			return this->_loadIllegalWords(m_language, path);
	}

	JG_F::KDirectory dir;
	JG_F::KDirectory::FileList files;

	if(!dir.Open(path)) return FALSE;
	if(!dir.ListFile(files)) return FALSE;

	KLanguage language;
	int n = files.size();
	for(int i=0; i<n; i++)
	{
		JG_F::KFileData& fdata = files[i];
		if(!fdata.IsDir()) continue;

		int lang = language.languageFromName(fdata.m_shortName);
		if(!lang) continue;

		char path[512];
		sprintf_k(path, sizeof(path), "%s%c%s%cIllegalChars.txt", filename, PATH_SEPERATOR, fdata.m_shortName, PATH_SEPERATOR);
		this->_loadIllegalWords(lang, path);
	}

	return TRUE;
}
void FS_DeleteMessageByDate::execute()
{
	int n;
	char path[512];
	JG_F::KDirectory dir;
	JG_F::KDirectory::FileList flist;

	sprintf_k(path, sizeof(path), "%s/private", g_pApp->m_storageAgent.m_dataDir.c_str());
	dir.Open(path);

	flist.clear();
	dir.ListFile(flist);

	n = flist.size();
	for(int i=0; i<n; i++)
	{
		const JG_F::KFileData& fdata = flist.at(i);
		if(!fdata._isDir()) continue;
		int n = str2int(fdata.m_shortName);
		if(!n) continue;
		if(n <= m_yyyymmdd)
		{
			JG_F::KFileData::FilePath filePath = fdata.getPath();
			JG_F::KFileUtil::rmDirRecursive(filePath.c_str());
			Log(LOG_WARN, "warn: recursive rmDir '%s'", filePath.c_str());
		}
	}

	sprintf_k(path, sizeof(path), "%s/public", g_pApp->m_storageAgent.m_dataDir.c_str());
	dir.Open(path);

	flist.clear();
	dir.ListFile(flist);

	n = flist.size();
	for(int i=0; i<n; i++)
	{
		const JG_F::KFileData& fdata = flist.at(i);
		if(!fdata._isDir()) continue;
		int n = str2int(fdata.m_shortName);
		if(!n) continue;
		if(n <= m_yyyymmdd)
		{
			JG_F::KFileData::FilePath filePath = fdata.getPath();
			JG_F::KFileUtil::rmDirRecursive(filePath.c_str());
			Log(LOG_WARN, "warn: recursive rmDir '%s'", filePath.c_str());
		}
	}

	return;
}