Skip to content

Commit

Permalink
replace access() with fopen().
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed May 14, 2012
1 parent bb8b8c8 commit 3383385
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libretro/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ lprintf(LO_ALWAYS, "wfname: %s\n", wfname);
};

int i;
FILE *file = NULL;
/* Precalculate a length we will need in the loop */
size_t pl = strlen(wfname) + strlen(ext) + 4;

Expand All @@ -524,10 +525,15 @@ lprintf(LO_ALWAYS, "wfname: %s\n", wfname);
sprintf(p, wfname);
lprintf(LO_ALWAYS, "p: %s\n", p);

if (access(p,F_OK))
file = fopen(p, "rb");
if (!file)
{
strcat(p, ext);
if (!access(p,F_OK)) {
file = fopen(p, "rb");
}
if (file) {
lprintf(LO_INFO, " found %s\n", p);
fclose(file);
return p;
}
free(p);
Expand Down

0 comments on commit 3383385

Please sign in to comment.