Browse Source

getLocalIP: Added macOS support

master
Robin Lohuis 8 years ago
parent
commit
e70e1dd518
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      OOequipment/subfiles/getLocalIP.m

+ 5
- 1
OOequipment/subfiles/getLocalIP.m View File

@@ -9,7 +9,11 @@ function [ ipaddress ] = getLocalIP()
ipaddress = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}','match'); ipaddress = regexp(result,'(?<=\n IPv4 Address[ \.]*: )([0-9]{1,3}\.?){4}','match');
elseif ismac elseif ismac
% Code to run on Mac platform % 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 elseif isunix
% Code to run on Unix platform % Code to run on Unix platform
else else


Loading…
Cancel
Save