Fix Linux launch args & updater switching build type

This commit is contained in:
Natsumi
2025-02-25 00:48:49 +13:00
parent d5e789ef0e
commit ea07194b1c
4 changed files with 37 additions and 24 deletions
+19 -14
View File
@@ -69,18 +69,22 @@ namespace VRCX
private static void GetVersion() private static void GetVersion()
{ {
var buildName = "VRCX";
try try
{ {
Version = $"{buildName} {File.ReadAllText(Path.Join(BaseDirectory, "Version"))}"; var versionFile = File.ReadAllText(Path.Join(BaseDirectory, "Version")).Trim();
}
catch (Exception)
{
Version = $"{buildName} Build";
}
Version = Version.Replace("\r", "").Replace("\n", ""); // 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 ex)
{
logger.Error(ex, "Failed to read version file");
Version = "VRCX Nightly Build";
}
} }
private static void ConfigureLogger() private static void ConfigureLogger()
@@ -207,7 +211,8 @@ namespace VRCX
private static void Run() private static void Run()
{ {
StartupArgs.ArgsCheck(); var args = Environment.GetCommandLineArgs();
StartupArgs.ArgsCheck(args);
SetProgramDirectories(); SetProgramDirectories();
VRCXStorage.Instance.Load(); VRCXStorage.Instance.Load();
BrowserSubprocess.Start(); BrowserSubprocess.Start();
@@ -258,10 +263,10 @@ namespace VRCX
ProcessMonitor.Instance.Exit(); ProcessMonitor.Instance.Exit();
} }
#else #else
public static void PreInit(string version) public static void PreInit(string version, string[] args)
{ {
Version = version; Version = version;
StartupArgs.ArgsCheck(); StartupArgs.ArgsCheck(args);
SetProgramDirectories(); SetProgramDirectories();
} }
@@ -281,9 +286,9 @@ namespace VRCX
#if LINUX #if LINUX
public class ProgramElectron 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() public void Init()
+2 -5
View File
@@ -25,14 +25,11 @@ namespace VRCX
private const string SubProcessTypeArgument = "--type"; private const string SubProcessTypeArgument = "--type";
public static VrcxLaunchArguments LaunchArguments = new(); public static VrcxLaunchArguments LaunchArguments = new();
public static void ArgsCheck() public static void ArgsCheck(string[] args)
{ {
var args = Environment.GetCommandLineArgs();
Debug.Assert(Program.LaunchDebug = true); Debug.Assert(Program.LaunchDebug = true);
var currentProcessArgs = ParseArgs(args); LaunchArguments = ParseArgs(args);
LaunchArguments = currentProcessArgs;
if (LaunchArguments.IsDebug) if (LaunchArguments.IsDebug)
Program.LaunchDebug = true; Program.LaunchDebug = true;
+14 -4
View File
@@ -36,7 +36,7 @@ const InteropApi = require('./InteropApi');
const interopApi = new InteropApi(); const interopApi = new InteropApi();
const version = getVersion(); const version = getVersion();
interopApi.getDotNetObject('ProgramElectron').PreInit(version); interopApi.getDotNetObject('ProgramElectron').PreInit(version, args);
interopApi.getDotNetObject('VRCXStorage').Load(); interopApi.getDotNetObject('VRCXStorage').Load();
interopApi.getDotNetObject('ProgramElectron').Init(); interopApi.getDotNetObject('ProgramElectron').Init();
interopApi.getDotNetObject('SQLiteLegacy').Init(); interopApi.getDotNetObject('SQLiteLegacy').Init();
@@ -494,13 +494,23 @@ function getHomePath() {
} }
function getVersion() { function getVersion() {
let version = 'VRCX (Linux) Build';
try { 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) { } catch (err) {
console.error('Error reading Version:', err); console.error('Error reading Version:', err);
return 'VRCX (Linux) Nightly Build';
} }
return version;
} }
function isDotNetInstalled() { function isDotNetInstalled() {
+4 -3
View File
@@ -3815,7 +3815,8 @@ console.log(`isLinux: ${LINUX}`);
if (!this.appVersion) { if (!this.appVersion) {
return; return;
} }
if (this.appVersion.includes('VRCX Nightly')) { var currentVersion = this.appVersion.replace(' (Linux)', '');
if (currentVersion.includes('VRCX Nightly')) {
this.branch = 'Nightly'; this.branch = 'Nightly';
} else { } else {
this.branch = 'Stable'; this.branch = 'Stable';
@@ -6627,8 +6628,8 @@ console.log(`isLinux: ${LINUX}`);
n: 10, n: 10,
offset: 0, offset: 0,
search: this.searchText, search: this.searchText,
customFields: this.searchUserByBio ? "bio" : "displayName", customFields: this.searchUserByBio ? 'bio' : 'displayName',
sort: this.searchUserSortByLastLoggedIn ? "last_login" : "relevance" sort: this.searchUserSortByLastLoggedIn ? 'last_login' : 'relevance'
}; };
await this.moreSearchUser(); await this.moreSearchUser();
}; };