- 精华
- 0
- 帖子
- 235
- 威望
- 0 点
- 积分
- 248 点
- 种子
- 24 点
- 注册时间
- 2012-7-14
- 最后登录
- 2025-5-23
|
发表于 2025-5-17 15:15 · 安徽
|
显示全部楼层
本帖最后由 xbox1978 于 2025-5-17 15:34 编辑
#include <sys/statvfs.h> // 用于获取文件系统信息
// 检查文件系统是否为FAT32或exFAT
static int isSupportedFilesystem(const char *path) {
struct statvfs fsInfo;
if (statvfs(path, &fsInfo) != 0) {
return 0; // 获取文件系统信息失败,默认不支持
}
// 检查文件系统类型
if (strcmp(fsInfo.f_basetype, "vfat") == 0 || // FAT32
strcmp(fsInfo.f_basetype, "exfat") == 0) { // exFAT
return 1;
}
return 0;
}
int sbReadList(base_game_info_t **list, const char *prefix, int *fsize, int *gamecount) {
// 检查文件系统是否支持
if (!isSupportedFilesystem(prefix)) {
LOG("Unsupported filesystem. Only FAT32 and exFAT are allowed for writing game lists.\n");
return 0;
}
// 原有的函数逻辑
int fd, size, id = 0, result;
int count;
char path[256];
free(*list);
*list = NULL;
*fsize = -1;
*gamecount = 0;
// 错误识别到记忆卡时,跳过扫描
if (strncasecmp(prefix, "mc", 2) == 0) {
return 0;
}
// ... 其余原有代码保持不变 ...
}
supportbase.c修改部分,你做一下参考 |
|