mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-12 18:51:15 +00:00
Todo: Fix: Misc crashes when interacting on island. Todo: Fix: Joystick pointer is slow to move. Todo: Fix: Touch doesn't behave.
30 lines
600 B
C++
30 lines
600 B
C++
#include <cstdio>
|
|
#include <sys/stat.h>
|
|
|
|
#include "filesys.h"
|
|
|
|
bool NX_GetPathInfo(const char *path, SDL_PathInfo *info)
|
|
{
|
|
struct stat st_info;
|
|
if (stat(path, &st_info) != 0)
|
|
{
|
|
if (info) info->type = SDL_PATHTYPE_NONE;
|
|
return false;
|
|
}
|
|
|
|
if (st_info.st_mode & S_IFDIR)
|
|
{
|
|
if (info)info->type = SDL_PATHTYPE_DIRECTORY;
|
|
return true;
|
|
}
|
|
|
|
if (info) info->type = SDL_PATHTYPE_FILE;
|
|
if (!info) return true;
|
|
|
|
auto *fp = fopen(path, "r");
|
|
fseek(fp, 0, SEEK_END);
|
|
if (info) info->size = ftell(fp);
|
|
fclose(fp);
|
|
|
|
return true;
|
|
} |