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

18 lines
504 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)
disk->type = FF_DISK_TYPE_HIDDEN;
else if(fs->f_flags & MNT_REMOVABLE)
disk->type = FF_DISK_TYPE_EXTERNAL;
else
disk->type = FF_DISK_TYPE_REGULAR;
ffStrbufInitS(&disk->name, [NSFileManager.defaultManager displayNameAtPath:@(fs->f_mntonname)].UTF8String);
}