Пример #1
0
kString *knh_buff_newRealPathString(CTX, kBytes *ba, size_t pos)
{
	char buf[K_PATHMAX], *path = (char*)knh_Bytes_ensureZero(_ctx, ba) + pos;
#if defined(K_USING_WINDOWS_)
	char *ptr = _fullpath(buf, path, K_PATHMAX);
#elif defined(K_USING_POSIX_)
	char *ptr = realpath(path, buf);
#else
	char *ptr = NULL;
	KNH_TODO("realpath in your new environment");
#endif
	kString *s = new_String(_ctx, (const char*)ptr);
	if(ptr != buf && ptr != NULL) {
		free(ptr);
	}
	return s;
}
Пример #2
0
kbool_t knh_buff_isdir(CTX, kBytes *ba, size_t pos)
{
	return knh_isdir(_ctx, knh_Bytes_ensureZero(_ctx, ba) + pos);
}
Пример #3
0
kbool_t knh_buff_isfile(CTX ctx, kBytes *ba, size_t pos)
{
	return knh_isfile(ctx, knh_Bytes_ensureZero(ctx, ba) + pos);
}