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

View File

@@ -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()

View File

@@ -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;

View File

@@ -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() {

View File

@@ -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();
};