示例#1
0
char *ro_gui_download_canonicalise(const char *path)
{
	os_error *error;
	int spare = 0;
	char *buf;

	error = xosfscontrol_canonicalise_path(path, NULL, NULL, NULL, 0, &spare);
	if (error) {
		LOG(("xosfscontrol_canonicalise_path: 0x%x: %s",
			error->errnum, error->errmess));
		return NULL;
	}

	buf = malloc(1 - spare);
	if (buf) {
		error = xosfscontrol_canonicalise_path(path, buf, NULL, NULL,
				1 - spare, NULL);
		if (error) {
			LOG(("xosfscontrol_canonicalise_path: 0x%x: %s",
				error->errnum, error->errmess));

			free(buf);
			return NULL;
		}
	}

	return buf;
}
示例#2
0
static PyObject *canon(char *path)
{ int len;
  PyObject *obj;
  char *buf;
  e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len);
  if(e) return riscos_oserror();
  obj=PyString_FromStringAndSize(NULL,-len);
  if(obj==NULL) return NULL;
  buf=PyString_AsString(obj);
  e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len);
  if(len!=1) return riscos_error("Error expanding path");
  if(!e) return obj;
  Py_DECREF(obj);
  return riscos_oserror();
}
示例#3
0
文件: sqRPCMain.c 项目: lsehub/Handle
int canonicalizeFilename(char * inString, char * outString) {
/* run a RISC OS format filename through canonicalize to make it correct */
int spare;
os_error * e;

	if ((e = xosfscontrol_canonicalise_path (inString, outString, (char const *) NULL, (char const *)NULL, MAXDIRNAMELENGTH, &spare)) != null) {
		return false;
	}
	return true;
}