From e70e1dd518c3b3bc08f40768d5b2cff0423319f0 Mon Sep 17 00:00:00 2001 From: Robin Lohuis Date: Sun, 17 Dec 2017 13:09:12 +0100 Subject: [PATCH] getLocalIP: Added macOS support --- OOequipment/subfiles/getLocalIP.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OOequipment/subfiles/getLocalIP.m b/OOequipment/subfiles/getLocalIP.m index cc578ec..c1dbde0 100644 --- a/OOequipment/subfiles/getLocalIP.m +++ b/OOequipment/subfiles/getLocalIP.m @@ -9,7 +9,11 @@ function [ ipaddress ] = getLocalIP() ipaddress = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}','match'); elseif ismac % Code to run on Mac platform - + [status,result]=system('ifconfig'); + if ~(status == 0) + error('Failed to find local IP address'); + end + ipaddress = regexp(result,'(?<=\n inet )([0-9]{1,3}\.?){4}','match'); elseif isunix % Code to run on Unix platform else