static int exe_path(char *filename, char *path) { #ifndef XFRACT char *ptr; if (dos_version() >= 300) /* DOS version 3.00+ ? */ { #ifdef __TURBOC__ strcpy(path, _argv[0]); #else /* assume MSC */ extern char **__argv; strcpy(path, __argv[0]); /* note: __argv may be undocumented in MSC */ #endif if(strcmp(filename,s_fractintexe)==0) if (can_read_file(path)) return (1); ptr = strrchr(path, SLASHC); if (ptr == NULL) ptr = path; else ++ptr; strcpy(ptr, filename); return (1); } return (0); #else strcpy(path,SRCDIR); strcat(path,"/"); strcat(path,filename); return 1; #endif }
static int find_file(char *filename, char *path) { if ( exe_path(filename, path) ) if( can_read_file(path)) return (1); findpath(filename,path); return ( (path[0]) ? 1 : 0); }
/* Returns the next filename that is a dead entry, or NULL if there are none * left. * * It will set the index on success. */ const char *plist_get_next_dead_entry (const struct plist *plist, int *last_index) { int i; assert (last_index != NULL); assert (plist != NULL); for (i = *last_index; i < plist->num; i++) { if (plist->items[i].file && ! plist_deleted(plist, i) && ! can_read_file(plist->items[i].file)) { *last_index = i + 1; return plist->items[i].file; } } return NULL; }
bool can_read_file(const std::string& aPath) { return can_read_file(convert_path(aPath)); }