@@ -35,26 +35,26 @@ function configure_nddshome_w_version(version, supportedVersions)
35
35
connextPath = get_rti_connext_dds_path(version );
36
36
37
37
nddshomePath = string(getenv(" NDDSHOME" ));
38
+ printWarningSupportedVersion = false ;
39
+
40
+ % Create string with supported versions of Connext.
41
+ productSupportedVersions = " " ;
42
+ for i = 1 : length(supportedVersions )
43
+ productSupportedVersions = productSupportedVersions + ...
44
+ " - RTI Connext DDS " + supportedVersions{i };
45
+ if i ~= length(supportedVersions )
46
+ productSupportedVersions = ...
47
+ productSupportedVersions + newline ;
48
+ end
49
+ end
50
+
38
51
% If NDDSHOME is already set, check it points to a supported version
39
52
if nddshomePath ~= " "
40
53
if is_rti_connext_dds_version_supported(nddshomePath ,...
41
54
supportedVersions ) == false
42
- % NDDSHOME is not set to a supported version. In case it is set
43
- % to a supported version, do not set it again to the RTI
44
- % Connext for DDS Blockset toolbox
45
- productSupportedVersions = " " ;
46
- for i = 1 : length(supportedVersions )
47
- productSupportedVersions = productSupportedVersions + ...
48
- " - RTI Connext DDS " + supportedVersions{i };
49
- if i ~= length(supportedVersions )
50
- productSupportedVersions = ...
51
- productSupportedVersions + newline ;
52
- end
53
- end
54
-
55
- warning([' NDDSHOME environment variable is not set ' ,...
56
- ' to a supported version for MATLAB/DDS Blockset. ' ,...
57
- ' Supported Connext versions for MATLAB %s :\n ' ,...
55
+ warning([' NDDSHOME environment variable is not set to a supported ' ...
56
+ ' version for MATLAB/DDS Blockset. Supported Connext versions ' ...
57
+ ' for MATLAB %s :' newline ...
58
58
' %s ' ],...
59
59
matlabRelease .Release ,...
60
60
productSupportedVersions );
@@ -63,23 +63,34 @@ function configure_nddshome_w_version(version, supportedVersions)
63
63
% Set NDDSHOME to the latest installed RTI Connext for DDS Blockset
64
64
% toolbox
65
65
if exist(connextPath , " dir" )
66
- setenv(" NDDSHOME" , connextPath );
66
+ if is_rti_connext_dds_version_supported(connextPath ,...
67
+ supportedVersions ) == false
68
+ warning([' The Connext Toolbox for DDS Blockset version %s ' ...
69
+ ' is not supported. Supported Connext versions ' ...
70
+ ' for MATLAB %s :' newline ...
71
+ ' %s ' ],...
72
+ version ,...
73
+ matlabRelease .Release ,...
74
+ productSupportedVersions );
75
+ else
76
+ setenv(" NDDSHOME" , connextPath );
77
+ end
67
78
else
68
79
error(" Error setting NDDSHOME, the path <%s> doesn't exist" ,...
69
80
connextPath );
70
81
end
71
82
end
72
83
end
73
84
74
- function ok = is_rti_connext_dds_version_supported(nddshome , supported_versions )
85
+ function ok = is_rti_connext_dds_version_supported(nddshome , supportedVersions )
75
86
% IS_RTI_CONNEXT_DDS_VERSION_SUPPORTED check whether the current
76
87
% nddshome is pointing to a supported version
77
88
% is_rti_connext_dds_version_supported() return true if that nddshome
78
89
% is supported
79
90
80
91
ok = false ;
81
- for i = 1 : length(supported_versions )
82
- if contains(nddshome , strcat(' rti_connext_dds-' ,supported_versions {i }))
92
+ for i = 1 : length(supportedVersions )
93
+ if contains(nddshome , strcat(' rti_connext_dds-' ,supportedVersions {i }))
83
94
ok = true ;
84
95
end
85
96
end
@@ -104,4 +115,4 @@ function configure_nddshome_w_version(version, supportedVersions)
104
115
else
105
116
error(' Unsupported OS' );
106
117
end
107
- end
118
+ end
0 commit comments