本文整理汇总了C++中FileList::GetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::GetPath方法的具体用法?C++ FileList::GetPath怎么用?C++ FileList::GetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileList
的用法示例。
在下文中一共展示了FileList::GetPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunFileBrowser
int RunFileBrowser(char *source, char *outname, const char *types[],
const char *info) {
int size = 0;
int index;
int offset_start, offset_end;
static int max_entries = 8;
int scrollModifier = 4;
int justsavedromdir = 0;
int scrollMult;
static int spy;
int y, i;
// Try to get a saved romdir from a config file
char* home = getenv("HOME");
char romcfgfile [128];
sprintf (romcfgfile, "%s/.fceux/romdir.cfg", home);
FILE * pFile;
pFile = fopen (romcfgfile,"r+");
if (pFile != NULL) {
fgets (s_LastDir , 128 , pFile);
fclose (pFile);
}
// Create file list
FileList *list = new FileList(source ? source : s_LastDir, types);
if (list == NULL)
return 0;
scrollModifier *= max_entries;
RESTART:
spy = 72;
size = list->Size();
index = 0;
offset_start = 0;
offset_end = size > max_entries ? max_entries : size;
g_dirty = 1;
while (1) {
// Parse input
readkey();
// TODO - put exit keys
// Go to previous folder or return ...
if (parsekey(DINGOO_B)) {
list->Enter(-1);
goto RESTART;
}
// Enter folder or select rom ...
if (parsekey(DINGOO_A)) {
if (list->GetSize(index) == -1) {
list->Enter(index);
goto RESTART;
} else {
strncpy(outname, list->GetPath(index), 128);
break;
}
}
if (parsekey(DINGOO_X)) {
return 0;
}
if (parsekey(DINGOO_SELECT)) {
// Save the current romdir in a config file
char* home = getenv("HOME");
char romcfgfile [128];
strncpy(s_LastDir, list->GetCurDir(), 128);
sprintf (romcfgfile, "%s/.fceux/romdir.cfg", home);
FILE * pFile;
pFile = fopen (romcfgfile,"w+");
fputs (s_LastDir,pFile);
fclose (pFile);
justsavedromdir = 1;
}
if (size > 0) {
// Move through file list
if (parsekey(DINGOO_R, 0)) {
index = size - 1;
spy = 72 + 15*(max_entries-1);
offset_end = size;
offset_start = offset_end - max_entries;
}
if (parsekey(DINGOO_L, 0)) {
goto RESTART;
}
if (parsekey(DINGOO_UP, 1)) {
//.........这里部分代码省略.........