Skip to content

Commit 1d92bf8

Browse files
committed
IO (macOS): fix logo fails to load from symlinked files
Fix #1395
1 parent 2cfc8ec commit 1d92bf8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/common/io/io.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ static inline bool ffPathExists(const char* path, FFPathType pathType)
118118
}
119119
else
120120
{
121+
#if __APPLE__ // #1395
122+
struct stat fileStat;
123+
if(stat(path, &fileStat) != 0)
124+
return false;
125+
126+
unsigned int mode = fileStat.st_mode & S_IFMT;
127+
128+
if(pathType & FF_PATHTYPE_FILE && mode != S_IFDIR)
129+
return true;
130+
131+
if(pathType & FF_PATHTYPE_DIRECTORY && mode == S_IFDIR)
132+
return true;
133+
#else
121134
size_t len = strlen(path);
122135
assert(len < PATH_MAX);
123136
if (len == 0) return false;
@@ -134,6 +147,7 @@ static inline bool ffPathExists(const char* path, FFPathType pathType)
134147
else
135148
ret = access(path, F_OK);
136149
return pathType == FF_PATHTYPE_DIRECTORY ? ret == 0 : ret == -1 && errno == ENOTDIR;
150+
#endif
137151
}
138152

139153
#endif

0 commit comments

Comments
 (0)