Files
fastfetch/src/detection/disk/disk_apple.m
T

18 lines
516 B
Objective-C
Raw Normal View History

#include "disk.h"
2022-10-27 14:58:29 +08:00
#include <sys/mount.h>
#import <Foundation/Foundation.h>
2022-10-17 08:10:58 -07:00
2022-10-27 14:58:29 +08:00
void detectFsInfo(struct statfs* fs, FFDisk* disk)
{
2022-10-27 14:58:29 +08:00
// FreeBSD doesn't support these flags
if(fs->f_flags & MNT_DONTBROWSE)
2023-06-08 21:34:56 +08:00
disk->type = FF_DISK_TYPE_HIDDEN_BIT;
2022-10-27 14:58:29 +08:00
else if(fs->f_flags & MNT_REMOVABLE)
2023-06-08 21:34:56 +08:00
disk->type = FF_DISK_TYPE_EXTERNAL_BIT;
2022-10-27 14:58:29 +08:00
else
2023-06-08 21:34:56 +08:00
disk->type = FF_DISK_TYPE_REGULAR_BIT;
2022-10-27 14:58:29 +08:00
ffStrbufInitS(&disk->name, [NSFileManager.defaultManager displayNameAtPath:@(fs->f_mntonname)].UTF8String);
}