Exemplo n.º 1
0
std::string nscapi::core_wrapper::expand_path(std::string value) {
	if (!fNSAPIExpandPath)
		throw nscapi::nscapi_exception("NSCore has not been initiated...");
	unsigned int buf_len = LEGACY_BUFFER_LENGTH;
	char *buffer = new char[buf_len+1];
	if (fNSAPIExpandPath(value.c_str(), buffer, buf_len) != NSCAPI::isSuccess) {
		delete [] buffer;
		throw nscapi::nscapi_exception("Settings could not be retrieved.");
	}
	std::string ret = buffer;
	delete [] buffer;
	return ret;
}
std::string nscapi::core_wrapper::expand_path(std::string value) {
	if (!fNSAPIExpandPath)
		throw nscapi::nscapi_exception("NSCore has not been initiated...");
	unsigned int buf_len = LEGACY_BUFFER_LENGTH;
	char *buffer = new char[buf_len + 1];
	if (!NSCAPI::api_ok(fNSAPIExpandPath(value.c_str(), buffer, buf_len))) {
		delete[] buffer;
		throw nscapi::nscapi_exception("Failed to expand path: " + value);
	}
	std::string ret = buffer;
	delete[] buffer;
	return ret;
}