Skip to content

Commit f07e3e2

Browse files
committed
fix: versioning
1 parent 9791882 commit f07e3e2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ZXBStudio/Program.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static string Version
1414
{
1515
if(string.IsNullOrEmpty(_Version))
1616
{
17-
SetVerion();
17+
SetVersion();
1818
}
1919
return _Version;
2020
}
@@ -25,7 +25,7 @@ public static string VersionDate { get
2525
{
2626
if (string.IsNullOrEmpty(_VersionDate))
2727
{
28-
SetVerion();
28+
SetVersion();
2929
}
3030
return _VersionDate;
3131
}
@@ -45,14 +45,14 @@ public static void Main(string[] args)
4545
TypeNameHandling = TypeNameHandling.Auto,
4646
};
4747

48-
SetVerion();
48+
SetVersion();
4949

5050
BuildAvaloniaApp()
5151
.StartWithClassicDesktopLifetime(args);
5252
}
5353

5454

55-
public static void SetVerion()
55+
public static void SetVersion()
5656
{
5757
try
5858
{
@@ -61,15 +61,20 @@ public static void SetVerion()
6161
_Version = $"{version.Major}.{version.Minor}.{version.Build}";
6262
if (version.Revision != 0)
6363
{
64-
_Version = $"{Version} - beta {version.Revision}";
64+
_Version = $"{_Version} - beta {version.Revision}";
6565
}
66-
var buildDate = System.IO.File.GetLastWriteTime(assembly.Location);
66+
67+
string path = assembly.Location;
68+
if (string.IsNullOrEmpty(path))
69+
path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
70+
71+
var buildDate = System.IO.File.GetLastWriteTime(path);
6772
_VersionDate = buildDate.ToString("yyyy.MM.dd");
6873
}
6974
catch
7075
{
71-
_Version = "";
72-
_VersionDate = "";
76+
_Version = "Unknown";
77+
_VersionDate = "Unknown";
7378
}
7479
}
7580

0 commit comments

Comments
 (0)