diff options
author | Damiano Galassi <[email protected]> | 2018-06-08 16:59:25 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2018-06-08 16:59:25 +0200 |
commit | c762b2c0ec5b6fb58d1fd453e2b5aed526c6d693 (patch) | |
tree | e0ab43c5ddd28ed876158b689be0c93c2380d970 /test | |
parent | de7355d5ad5257c4cce5e0a99fffb3ee58264ba0 (diff) |
MacGui: set the minimum deployment target to 10.10. Remove Growl and use macOS standard notifications. Remove deprecated API usage and code that doesn't compile anymore (QTKit).
Diffstat (limited to 'test')
-rw-r--r-- | test/test.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/test/test.c b/test/test.c index 1e5ad2e47..0cfa90432 100644 --- a/test/test.c +++ b/test/test.c @@ -43,6 +43,7 @@ #include <IOKit/IOKitLib.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IODVDMedia.h> +#include <sys/mount.h> #endif #define LAPSHARP_DEFAULT_PRESET "medium" @@ -4888,46 +4889,23 @@ static void print_string_list(FILE *out, const char* const *list, const char *pr ****************************************************************************/ static char* bsd_name_for_path(char *path) { - OSStatus err; - FSRef ref; - err = FSPathMakeRef( (const UInt8 *) input, &ref, NULL ); - if( err != noErr ) - { - return NULL; - } + const char *prefix = "/dev/"; + struct statfs s; - // Get the volume reference number. - FSCatalogInfo catalogInfo; - err = FSGetCatalogInfo( &ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, - NULL); - if( err != noErr ) + if (statfs(path, &s) == -1) { return NULL; } - FSVolumeRefNum volRefNum = catalogInfo.volume; - // Now let's get the device name - GetVolParmsInfoBuffer volumeParms; - err = FSGetVolumeParms( volRefNum, &volumeParms, sizeof( volumeParms ) ); - if( err != noErr ) - { - return NULL; - } + size_t lenpre = strlen(prefix), + lenstr = strlen(s.f_mntfromname); - // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field. - // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h. - if( volumeParms.vMVersion < 4 ) + if (lenstr > lenpre && strncmp(prefix, s.f_mntfromname, lenpre) == 0) { - return NULL; - } - - // vMDeviceID might be zero as is reported with experimental ZFS (zfs-119) support in Leopard. - if( !volumeParms.vMDeviceID ) - { - return NULL; + return strdup(s.f_mntfromname + lenpre); } - return strdup( volumeParms.vMDeviceID ); + return strdup(s.f_mntfromname); } /**************************************************************************** |