equal
deleted
inserted
replaced
294 BAIL_IF(remove(path) == -1, errcodeFromErrno(), 0); |
294 BAIL_IF(remove(path) == -1, errcodeFromErrno(), 0); |
295 return 1; |
295 return 1; |
296 } /* __PHYSFS_platformDelete */ |
296 } /* __PHYSFS_platformDelete */ |
297 |
297 |
298 |
298 |
299 int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st) |
299 int __PHYSFS_platformStat(const char *fname, PHYSFS_Stat *st, const int follow) |
300 { |
300 { |
301 struct stat statbuf; |
301 struct stat statbuf; |
302 |
302 const int rc = follow ? stat(fname, &statbuf) : lstat(fname, &statbuf); |
303 BAIL_IF(lstat(filename, &statbuf) == -1, errcodeFromErrno(), 0); |
303 BAIL_IF(rc == -1, errcodeFromErrno(), 0); |
304 |
304 |
305 if (S_ISREG(statbuf.st_mode)) |
305 if (S_ISREG(statbuf.st_mode)) |
306 { |
306 { |
307 st->filetype = PHYSFS_FILETYPE_REGULAR; |
307 st->filetype = PHYSFS_FILETYPE_REGULAR; |
308 st->filesize = statbuf.st_size; |
308 st->filesize = statbuf.st_size; |
328 |
328 |
329 st->modtime = statbuf.st_mtime; |
329 st->modtime = statbuf.st_mtime; |
330 st->createtime = statbuf.st_ctime; |
330 st->createtime = statbuf.st_ctime; |
331 st->accesstime = statbuf.st_atime; |
331 st->accesstime = statbuf.st_atime; |
332 |
332 |
333 st->readonly = (access(filename, W_OK) == -1); |
333 st->readonly = (access(fname, W_OK) == -1); |
334 return 1; |
334 return 1; |
335 } /* __PHYSFS_platformStat */ |
335 } /* __PHYSFS_platformStat */ |
336 |
336 |
337 |
337 |
338 typedef struct |
338 typedef struct |