Beispiel #1
0
std::string BusClient::appConfDir(const MojString& appId, PackageType type, PackageLocation location)
{
	MojLogTrace(m_log);
	std::string confPath;

	switch (location) {
	case System:
		confPath = "/";
		break;
	case ThirdParty:
		confPath = BASE_CRYPTOFS;
		break;
	}

	confPath += BASE_PALM_OFFSET;

	switch (type) {
	case Application:
		confPath += APPS_DIR;
		break;
	case Service:
		confPath += SERVICES_DIR;
		break;
	}
	confPath.append(appId.begin(), appId.end());
	if (access(confPath.c_str(), R_OK) != 0) {
		m_wrongAplication = true;
	}

	return confPath + CONF_SUBDIR;
}
Beispiel #2
0
MojErr MojDbIndex::validateName(const MojString& name)
{
	if (name.length() > MaxIndexNameLen) {
		MojErrThrowMsg(MojErrDbInvalidIndexName, _T("db: index name '%s' invalid: length is %zd chars, max is %zd"), name.data(), name.length(), MaxIndexNameLen);
	}
	for (MojString::ConstIterator i = name.begin(); i < name.end(); ++i) {
		if (!MojIsAlNum(*i) && *i != _T('_')) {
			MojErrThrowMsg(MojErrDbInvalidIndexName, _T("db: index name '%s' invalid: char at position %zd not allowed"), name.data(), (MojSize) (i - name.begin()));
		}
	}
	return MojErrNone;
}