Auswertung Experiment
Database tüddelei DBHanlder läuft gut für DIESE Datanbank struktur... App begonnen aber weit entfernt von gutem Stand
This commit is contained in:
36
Libs/mat2tikz/test/private/OSVersion.m
Normal file
36
Libs/mat2tikz/test/private/OSVersion.m
Normal 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
|
||||
Reference in New Issue
Block a user