void CBINDInstallDlg::ReadInstallFileList() {
	std::ifstream fl(m_currentDir + "\\InstallFiles");
	if (!fl) {
		throw(Exception(IDS_FILE_BAD, "InstallFiles", "can't open"));
	}
	while (!fl.eof()) {
		std::string line;
		getline(fl, line);
		if (line.empty())
			continue;
		if (line[0] == '#')
			continue;
		// zip -l adds spurious \r: remove trailing space chars
		size_t finish = line.find_last_not_of(" \t\r\n\t\v");
		if ((finish != std::string::npos) &&
		    (finish + 1 != line.size())) {
			line.erase(finish + 1);
		}
		size_t flags = line.find_last_of('-');
		if ((flags == std::string::npos) ||
		    (flags + 5 != line.size()))
			goto bad;
		std::string file = line.substr(0, flags);
		if (file.empty() || (file.size() > 127))
			goto bad;
		FileData entry;
		memmove(entry.filename, file.c_str(), file.size() + 1);
		switch (line[flags + 1]) {
		case 'T':
			entry.destination = FileData::TargetDir;
			break;
		case 'B':
			entry.destination = FileData::BinDir;
			break;
		case 'E':
			entry.destination = FileData::EtcDir;
			break;
		case 'W':
			entry.destination = FileData::WinSystem;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 2]) {
		case 'T':
			entry.importance = FileData::Trivial;
			break;
		case 'N':
			entry.importance = FileData::Normal;
			break;
		case 'C':
			entry.importance = FileData::Critical;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 3]) {
		case 'T':
			entry.checkVer = TRUE;
			break;
		case 'F':
			entry.checkVer = FALSE;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 4]) {
		case 'T':
			entry.withTools = TRUE;
			break;
		case 'F':
			entry.withTools = FALSE;
			break;
		default:
			goto bad;
		}
		installFiles.push_back(entry);
	}
	return;

bad:
	throw(Exception(IDS_FILE_BAD, "InstallFiles", "syntax error"));
}
void CBINDInstallDlg::ReadInstallFileList() {
	std::ifstream fl(m_currentDir + "\\InstallFiles");
	if (!fl) {
		throw(Exception(IDS_FILE_BAD, "InstallFiles", "can't open"));
	}
	while (!fl.eof()) {
		std::string line;
		getline(fl, line);
		if (line.empty())
			continue;
		if (line[0] == '#')
			continue;
		 
		size_t finish = line.find_last_not_of(" \t\r\n\t\v");
		if ((finish != std::string::npos) &&
		    (finish + 1 != line.size())) {
			line.erase(finish + 1);
		}
		size_t flags = line.find_last_of('-');
		if ((flags == std::string::npos) ||
		    (flags + 5 != line.size()))
			goto bad;
		std::string file = line.substr(0, flags);
		if (file.empty() || (file.size() > 127))
			goto bad;
		FileData entry;
		memmove(entry.filename, file.c_str(), file.size() + 1);
		switch (line[flags + 1]) {
		case 'T':
			entry.destination = FileData::TargetDir;
			break;
		case 'B':
			entry.destination = FileData::BinDir;
			break;
		case 'E':
			entry.destination = FileData::EtcDir;
			break;
		case 'W':
			entry.destination = FileData::WinSystem;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 2]) {
		case 'T':
			entry.importance = FileData::Trivial;
			break;
		case 'N':
			entry.importance = FileData::Normal;
			break;
		case 'C':
			entry.importance = FileData::Critical;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 3]) {
		case 'T':
			entry.checkVer = TRUE;
			break;
		case 'F':
			entry.checkVer = FALSE;
			break;
		default:
			goto bad;
		}
		switch (line[flags + 4]) {
		case 'T':
			entry.withTools = TRUE;
			break;
		case 'F':
			entry.withTools = FALSE;
			break;
		default:
			goto bad;
		}
		installFiles.push_back(entry);
	}
	return;

bad:
	throw(Exception(IDS_FILE_BAD, "InstallFiles", "syntax error"));
}