Get True Home Path from possible symbolic link (Important for Atomic Distros like Fedora Silverblue) (#1085)

This commit is contained in:
Donad_VR
2025-01-20 09:47:41 +01:00
committed by GitHub
parent 37a9688b81
commit 95d5486cdb

View File

@@ -284,6 +284,8 @@ async function installVRCXappImageLauncher() {
*/
async function installVRCX() {
let homePath = getHomePath();
console.log('True Home path:', homePath);
console.log('AppImage path:', appImagePath);
if (!appImagePath) {
console.error('AppImage path is not available!');
@@ -300,9 +302,9 @@ async function installVRCX() {
appImageLauncherInstalled = true;
}
*/
if (
appImagePath.startsWith(path.join(app.getPath('home'), 'Applications'))
appImagePath.startsWith(path.join(homePath, 'Applications'))
) {
/*
if (appImageLauncherInstalled) {
@@ -331,7 +333,7 @@ async function installVRCX() {
if (
process.env.APPIMAGE.startsWith(
path.join(app.getPath('home'), 'Applications')
path.join(homePath, 'Applications')
) &&
path.basename(process.env.APPIMAGE) === 'VRCX.AppImage'
) {
@@ -340,7 +342,7 @@ async function installVRCX() {
return;
}
const targetPath = path.join(app.getPath('home'), 'Applications');
const targetPath = path.join(homePath, 'Applications');
console.log('Target Path:', targetPath);
// Create target directory if it doesn't exist
@@ -368,7 +370,7 @@ async function installVRCX() {
const iconUrl =
'https://raw.githubusercontent.com/vrcx-team/VRCX/master/VRCX.png';
const iconPath = path.join(
app.getPath('home'),
homePath,
'.local/share/icons/VRCX.png'
);
await downloadIcon(iconUrl, iconPath)
@@ -386,7 +388,7 @@ StartupWMClass=VRCX
`;
const desktopFilePath = path.join(
app.getPath('home'),
homePath,
'.local/share/applications/VRCX.desktop'
);
try {
@@ -445,6 +447,20 @@ function getVRCXPath() {
return '';
}
function getHomePath() {
let relativeHomePath = path.join(app.getPath('home'));
// console.log('Relative Home Path: ' + relativeHomePath);
try {
let absoluteHomePath = fs.realpathSync(relativeHomePath);
// console.log('readlink output: ' + absoluteHomePath);
return absoluteHomePath;
}
catch (err) {
return relativeHomePath;
}
}
function getVersion() {
let version = 'VRCX (Linux) Build';
try {