Skip to content

Commit de6905d

Browse files
authored
Merge pull request #190 from mathworks/189-add-version-utilities-and-icons
189 add version utilities and icons
2 parents 5b45418 + d44a15b commit de6905d

12 files changed

Lines changed: 209 additions & 0 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="resolveFilePath.m" type="File"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="incrementVersionNumber.m" type="File"/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="design"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="readVersionNumber.m" type="File"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="loading_128.gif" type="File"/>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function versionStr = incrementVersionNumber(filePath)
2+
% Increments the last decimal of the version number
3+
%
4+
% Version file should be .txt and only contain a multi-part version with at
5+
% least 2 parts.
6+
% Valid version.txt Examples:
7+
% 2.4
8+
% 1.0.3
9+
% 1.3.9.2019
10+
11+
% Copyright 2026 The MathWorks Inc.
12+
13+
arguments (Input)
14+
filePath (1,1) string {mustBeFile}
15+
end
16+
17+
arguments (Output)
18+
versionStr (1,1) string
19+
end
20+
21+
% Read in the version info
22+
[~, versionParts] = wt.utility.readVersionNumber(filePath);
23+
24+
% Increment the build index in the version number
25+
numVersionParts = numel(versionParts);
26+
if numVersionParts < 2
27+
versionParts(2) = uint32(1);
28+
else
29+
versionParts(end) = versionParts(end) + uint32(1);
30+
end
31+
32+
% Format as string
33+
versionStr = join(string(versionParts),".");
34+
35+
% Update the version file
36+
writelines(versionStr, filePath);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
function [versionStr, versionParts] = readVersionNumber(filePath)
2+
% Retrieves the version number
3+
%
4+
% Version file should be .txt and only contain a multi-part version with at
5+
% least 2 parts.
6+
% Valid version.txt Examples:
7+
% 2.4
8+
% 1.0.3
9+
% 1.3.9.2019
10+
11+
% Copyright 2026 The MathWorks Inc.
12+
13+
arguments (Input)
14+
filePath (1,1) string {mustBeFile}
15+
end
16+
17+
arguments (Output)
18+
versionStr (1,1) string
19+
versionParts (1,:) uint32 {mustBeNonempty}
20+
end
21+
22+
% Read in the version parts
23+
versionParts = readmatrix(filePath,...
24+
"Delimiter",".",...
25+
"OutputType","uint32");
26+
27+
% Format as string
28+
versionStr = join(string(versionParts),".");

0 commit comments

Comments
 (0)