コード例 #1
0
void DefaultPath (char *path, const char *basepath, size_t len)
{
	char	temp[128];

	if (path[0] == '/' || path[0] == '\\')
		return;		// absolute path location
	if (path[0] != '\0' && path[1] == ':')
		return;		// absolute path location, like c:\dir

	qerr_strlcpy(__thisfunc__, __LINE__, temp, path, sizeof(temp));
	qerr_strlcpy(__thisfunc__, __LINE__, path, basepath, len);
	qerr_strlcat(__thisfunc__, __LINE__, path, temp, len);
}
コード例 #2
0
char *ExpandArg (const char *path)
{
	static char full[1024];

	if (path[0] != '/' && path[0] != '\\' && path[1] != ':')
	{
		Q_getwd (full, sizeof(full));
		qerr_strlcat(__thisfunc__, __LINE__, full, path, sizeof(full));
	}
	else
	{
		qerr_strlcpy(__thisfunc__, __LINE__, full, path, sizeof(full));
	}

	return full;
}
コード例 #3
0
ファイル: util_io.c プロジェクト: svn2github/uhexen2
void Q_getwd (char *out, size_t size, qboolean trailing_dirsep)
{
#if 0
	qerr_strlcpy(__thisfunc__, __LINE__, out, "PROGDIR:", size);
#else
	size_t sz;
	if (NameFromLock(((struct Process *) FindTask(NULL))->pr_CurrentDir, (STRPTR) out, size) == 0)
		COM_Error ("Couldn't determine current directory");
	if (!trailing_dirsep)
		return;
	sz = strlen(out);
	if (!sz || out[sz - 1] == ':' || out[sz - 1] == '/')
		return;
	qerr_strlcat(__thisfunc__, __LINE__, out, "/", size);
#endif
}