Commit Friday evening.

PDFA and EXFO Laser are now part of the family
This commit is contained in:
Silas Labor Zizou
2024-10-25 20:31:50 +02:00
parent bafc7f12b7
commit 99fe2ca106
208 changed files with 28244 additions and 460 deletions

View File

@@ -0,0 +1,36 @@
function [formatted, OSType, OSVersion] = OSVersion()
% determines the OS type and its (kernel) version number
if ismac
OSType = 'Mac OS';
[dummy, OSVersion] = system('sw_vers -productVersion'); %#ok
% Output like "10.10.4" for OS X Yosemite
elseif ispc
OSType = 'Windows';
[dummy, rawVersion] = system('ver'); %#ok
% Output like "Microsoft Windows [Version 6.3.9600]" for Win8.1
pattern = '(?<=Version )[0-9.]+';
OSVersion = regexpi(rawVersion, pattern, 'match', 'once');
elseif isunix
[dummy, OSType] = system('uname -s'); %#ok
% This returns the kernal name
% e.g. "Linux" on Linux, "Darwin" on Mac, "SunOS" on Solaris
[dummy, OSVersion] = system('uname -r'); %#ok
% Returns the kernel version. Many Linux distributions
% include an identifier, e.g. "4.0.7-2-ARCH" on Arch Linux
% TODO: also use `lsb_release` in Linux for distro info
else
warning('OSVersion:UnknownOS', 'Could not recognize OS.');
OSType = 'Unknown OS';
OSVersion = '';
end
EOL = sprintf('\n');
OSType = strrep(OSType, EOL, '');
OSVersion = strrep(OSVersion, EOL, '');
formatted = strtrim([OSType ' ' OSVersion]);
end