Exemple #1
0
String Path::Combine(RCString path1, RCString path2) {
	if (path2.IsEmpty())
		return path1;
	if (path1.IsEmpty() || IsPathRooted(path2))
		return path2;
	return AddDirSeparator(path1)+path2;
}
Exemple #2
0
DirectoryInfo Directory::CreateDirectory(RCString path) {
	vector<String> ar = path.Split(String(Path::DirectorySeparatorChar)+String(Path::AltDirectorySeparatorChar));
	String dir;
	bool b = true;
	for (int i=0; i<ar.size(); i++) {
		dir = AddDirSeparator(dir+ar[i]);
#if UCFG_USE_POSIX
		if (::mkdir(dir, 0777) < 00 && errno!=EEXIST && errno!=EISDIR)
			CCheck(-1);
	}
#else
		b = ::CreateDirectory(dir, 0);
	}
Exemple #3
0
bool FtpDataAnalyzer::TryRecognize() {
	if (m_ci->GetWasSYN()) {
		TRC(2, m_ci->DstEndPoint);

		FtpAnalyzerClass::CDataEndpoints::iterator it = FtpAnalyzerClass::I->DataEndpoints.find(m_ci->DstEndPoint);
		if (it != FtpAnalyzerClass::I->DataEndpoints.end()) {
			FileMessage = it->second.first;
			FtpAnalyzerClass::I->DataEndpoints.erase(it);
			Capture();

#if UCFG_SNIF_PACKET_CAPTURE
			if (CTcpMan::s_bEnableLog && FileMessage && g_opt_SaveFiles) {
				String dir = Path::Combine(g_ftpMessageAnalyzerClass.Dir, "files");
				String fullpath = AddDirSeparator(dir)+ FileMessage->Filename;
				Directory::CreateDirectory(Path::GetDirectoryName(fullpath));
				FileMessage->m_stm.Open(fullpath, FileMode::Create, FileAccess::Write);
			}
#endif
			return true;
		}
	}
	Delete();
	return false;
}