diff --git a/Dotnet/Program.cs b/Dotnet/Program.cs index ecaaf71b..0ce95daf 100644 --- a/Dotnet/Program.cs +++ b/Dotnet/Program.cs @@ -69,18 +69,22 @@ namespace VRCX private static void GetVersion() { - var buildName = "VRCX"; - try { - Version = $"{buildName} {File.ReadAllText(Path.Join(BaseDirectory, "Version"))}"; + var versionFile = File.ReadAllText(Path.Join(BaseDirectory, "Version")).Trim(); + + // look for trailing git hash "-22bcd96" to indicate nightly build + var version = versionFile.Split('-'); + if (version.Length > 0 && version[^1].Length == 7) + Version = $"VRCX Nightly {versionFile}"; + else + Version = $"VRCX {versionFile}"; } - catch (Exception) + catch (Exception ex) { - Version = $"{buildName} Build"; + logger.Error(ex, "Failed to read version file"); + Version = "VRCX Nightly Build"; } - - Version = Version.Replace("\r", "").Replace("\n", ""); } private static void ConfigureLogger() @@ -207,7 +211,8 @@ namespace VRCX private static void Run() { - StartupArgs.ArgsCheck(); + var args = Environment.GetCommandLineArgs(); + StartupArgs.ArgsCheck(args); SetProgramDirectories(); VRCXStorage.Instance.Load(); BrowserSubprocess.Start(); @@ -258,10 +263,10 @@ namespace VRCX ProcessMonitor.Instance.Exit(); } #else - public static void PreInit(string version) + public static void PreInit(string version, string[] args) { Version = version; - StartupArgs.ArgsCheck(); + StartupArgs.ArgsCheck(args); SetProgramDirectories(); } @@ -281,9 +286,9 @@ namespace VRCX #if LINUX public class ProgramElectron { - public void PreInit(string version) + public void PreInit(string version, string[] args) { - Program.PreInit(version); + Program.PreInit(version, args); } public void Init() diff --git a/Dotnet/StartupArgs.cs b/Dotnet/StartupArgs.cs index 3a8ea3e8..75799e2f 100644 --- a/Dotnet/StartupArgs.cs +++ b/Dotnet/StartupArgs.cs @@ -25,14 +25,11 @@ namespace VRCX private const string SubProcessTypeArgument = "--type"; public static VrcxLaunchArguments LaunchArguments = new(); - public static void ArgsCheck() + public static void ArgsCheck(string[] args) { - var args = Environment.GetCommandLineArgs(); - Debug.Assert(Program.LaunchDebug = true); - var currentProcessArgs = ParseArgs(args); - LaunchArguments = currentProcessArgs; + LaunchArguments = ParseArgs(args); if (LaunchArguments.IsDebug) Program.LaunchDebug = true; diff --git a/src-electron/main.js b/src-electron/main.js index a9bbfb84..94e16fac 100644 --- a/src-electron/main.js +++ b/src-electron/main.js @@ -36,7 +36,7 @@ const InteropApi = require('./InteropApi'); const interopApi = new InteropApi(); const version = getVersion(); -interopApi.getDotNetObject('ProgramElectron').PreInit(version); +interopApi.getDotNetObject('ProgramElectron').PreInit(version, args); interopApi.getDotNetObject('VRCXStorage').Load(); interopApi.getDotNetObject('ProgramElectron').Init(); interopApi.getDotNetObject('SQLiteLegacy').Init(); @@ -494,13 +494,23 @@ function getHomePath() { } function getVersion() { - let version = 'VRCX (Linux) Build'; try { - version = `VRCX (Linux) ${fs.readFileSync(path.join(rootDir, 'Version'), 'utf8').trim()}`; + var versionFile = fs + .readFileSync(path.join(rootDir, 'Version'), 'utf8') + .trim(); + + // look for trailing git hash "-22bcd96" to indicate nightly build + var version = versionFile.split('-'); + console.log('Version:', version); + if (version.length > 0 && version[version.length - 1].length == 7) { + return `VRCX (Linux) Nightly ${versionFile}`; + } else { + return `VRCX (Linux) ${versionFile}`; + } } catch (err) { console.error('Error reading Version:', err); + return 'VRCX (Linux) Nightly Build'; } - return version; } function isDotNetInstalled() { diff --git a/src/app.js b/src/app.js index 26dae236..2faa88fa 100644 --- a/src/app.js +++ b/src/app.js @@ -3815,7 +3815,8 @@ console.log(`isLinux: ${LINUX}`); if (!this.appVersion) { return; } - if (this.appVersion.includes('VRCX Nightly')) { + var currentVersion = this.appVersion.replace(' (Linux)', ''); + if (currentVersion.includes('VRCX Nightly')) { this.branch = 'Nightly'; } else { this.branch = 'Stable'; @@ -6627,8 +6628,8 @@ console.log(`isLinux: ${LINUX}`); n: 10, offset: 0, search: this.searchText, - customFields: this.searchUserByBio ? "bio" : "displayName", - sort: this.searchUserSortByLastLoggedIn ? "last_login" : "relevance" + customFields: this.searchUserByBio ? 'bio' : 'displayName', + sort: this.searchUserSortByLastLoggedIn ? 'last_login' : 'relevance' }; await this.moreSearchUser(); };