示例#1
0
FLISTH
file_list1st(const OEMCHAR *dir, FLINFO *fli)
{
	FLISTH ret;

	ret = (FLISTH)_MALLOC(sizeof(_FLISTH), "FLISTH");
	if (ret == NULL) {
		VERBOSE(("file_list1st: couldn't alloc memory (size = %d)", sizeof(_FLISTH)));
		return FLISTH_INVALID;
	}

	milstr_ncpy(ret->path, dir, sizeof(ret->path));
	file_setseparator(ret->path, sizeof(ret->path));
	ret->hdl = opendir(ret->path);
	VERBOSE(("file_list1st: opendir(%s)", ret->path));
	if (ret->hdl == NULL) {
		VERBOSE(("file_list1st: opendir failure"));
		_MFREE(ret);
		return FLISTH_INVALID;
	}
	if (file_listnext((FLISTH)ret, fli) == SUCCESS) {
		return (FLISTH)ret;
	}
	VERBOSE(("file_list1st: file_listnext failure"));
	closedir(ret->hdl);
	_MFREE(ret);
	return FLISTH_INVALID;
}
示例#2
0
文件: dosio.cpp 项目: utamaro/np2.js
FLISTH DOSIOCALL file_list1st(const OEMCHAR *dir, FLINFO *fli) {

	OEMCHAR path[MAX_PATH];
	file_cpyname(path, dir, NELEMENTS(path));
	file_setseparator(path, NELEMENTS(path));
	file_catname(path, str_wildcard, NELEMENTS(path));
	TRACEOUT(("file_list1st %s", path));
#if defined(OEMCHAR_SAME_TCHAR)
const TCHAR *tcharpath = path;
#else
	TCHAR tcharpath[MAX_PATH];
	oemtotchar(tcharpath, NELEMENTS(tcharpath), path, (UINT)-1);
#endif
	HANDLE hdl;
	WIN32_FIND_DATA w32fd;
	hdl = FindFirstFile(tcharpath, &w32fd);
	if (hdl != INVALID_HANDLE_VALUE) {
		do {
			if (setflist(&w32fd, fli) == SUCCESS) {
				return(hdl);
			}
		} while(FindNextFile(hdl, &w32fd));
		FindClose(hdl);
	}
	return(FLISTH_INVALID);
}
示例#3
0
static void VERMOUTHCL pathadd(MIDIMOD mod, const OEMCHAR *path) {

	_PATHLIST	pl;
	PATHLIST	p;

	ZeroMemory(&pl, sizeof(pl));
	if (path) {
		pl.path[0] = '\0';
		// separator change!
		file_catname(pl.path, path, NELEMENTS(pl.path));
		if (path[0]) {
#if defined(SUPPORT_ARC)
			if (milstr_chr(pl.path, '#') == NULL)
#endif
				file_setseparator(pl.path, NELEMENTS(pl.path));
		}
	}

	pl.next = mod->pathlist;
	p = pl.next;
	while(p) {
		if (!file_cmpname(p->path, pl.path)) {
			return;
		}
		p = p->next;
	}
	p = (PATHLIST)listarray_append(mod->pathtbl, &pl);
	if (p) {
		mod->pathlist = p;
	}
}
示例#4
0
文件: midimod.c 项目: utamaro/np2.js
static void pathadd(MIDIMOD mod, const OEMCHAR *path) {

	_PATHLIST	pl;
	PATHLIST	p;

	ZeroMemory(&pl, sizeof(pl));
	if (path) {
		pl.path[0] = '\0';
		// separator change!
		file_catname(pl.path, path, NELEMENTS(pl.path));
		if (path[0]) {
			file_setseparator(pl.path, NELEMENTS(pl.path));
		}
	}

	pl.next = mod->pathlist;
	p = pl.next;
	while(p) {
		if (!file_cmpname(p->path, pl.path)) {
			return;
		}
		p = p->next;
	}
	p = (PATHLIST)listarray_append(mod->pathtbl, &pl);
	if (p) {
		mod->pathlist = p;
	}
}
示例#5
0
文件: dosio.c 项目: FREEWING-JP/np2pi
FLISTH file_list1st(const char *dir, FLINFO *fli) {

	char			path[MAX_PATH];
	HANDLE			hdl;
	WIN32_FIND_DATA	w32fd;

	file_cpyname(path, dir, sizeof(path));
	file_setseparator(path, sizeof(path));
	file_catname(path, "*.*", sizeof(path));
	hdl = FindFirstFile(path, &w32fd);
	if (hdl != INVALID_HANDLE_VALUE) {
		do {
			if (setflist(&w32fd, fli) == SUCCESS) {
				return(hdl);
			}
		} while(FindNextFile(hdl, &w32fd));
		FindClose(hdl);
	}
	return(FLISTH_INVALID);
}
示例#6
0
文件: filesel.c 项目: utamaro/np2.js
static BOOL dlgupdate(void) {

	FLIST	fl;

	fl = getflist(menudlg_getval(DID_FLIST));
	if (fl == NULL) {
		return(FALSE);
	}
	file_setseparator(filesel.path, NELEMENTS(filesel.path));
	file_catname(filesel.path, fl->name, NELEMENTS(filesel.path));
	if (fl->isdir) {
		dlgsetlist();
		menudlg_settext(DID_FILE, NULL);
		return(FALSE);
	}
	else {
		filesel.result = TRUE;
		return(TRUE);
	}
}
示例#7
0
文件: dosio.c 项目: FREEWING-JP/np2pi
FLISTH file_list1st(const char *dir, FLINFO *fli) {

	FLISTH ret;

	ret = (FLISTH)_MALLOC(sizeof(_FLISTH), "FLISTH");
	if (ret == NULL) {
		return FLISTH_INVALID;
	}

	milstr_ncpy(ret->path, dir, sizeof(ret->path));
	file_setseparator(ret->path, sizeof(ret->path));
	ret->hdl = opendir(ret->path);
	if (ret->hdl == NULL) {
		_MFREE(ret);
		return FLISTH_INVALID;
	}
	if (file_listnext(ret, fli) == SUCCESS) {
		return ret;
	}
	closedir(ret->hdl);
	_MFREE(ret);
	return FLISTH_INVALID;
}
示例#8
0
/**
 * ファイルの検索
 * @param[in] lpPathName パス
 * @param[out] fli 検索結果
 * @return ファイル検索ハンドル
 */
FLISTH DOSIOCALL file_list1st(const OEMCHAR* lpPathName, FLINFO* fli)
{
	static const OEMCHAR s_szWildCard[] = OEMTEXT("*.*");

	OEMCHAR szPath[MAX_PATH];
	file_cpyname(szPath, lpPathName, NELEMENTS(szPath));
	file_setseparator(szPath, NELEMENTS(szPath));
	file_catname(szPath, s_szWildCard, NELEMENTS(szPath));

	WIN32_FIND_DATA w32fd;
	HANDLE hFile = ::FindFirstFile(szPath, &w32fd);
	if (hFile != INVALID_HANDLE_VALUE)
	{
		do
		{
			if (setFLInfo(w32fd, fli))
			{
				return hFile;
			}
		} while(::FindNextFile(hFile, &w32fd));
		::FindClose(hFile);
	}
	return FLISTH_INVALID;
}