You've already forked OneDriveGUI
mirror of
https://github.com/bpozdena/OneDriveGUI.git
synced 2026-10-24 04:59:17 +03:00
Merge pull request #303 from nikolainyegaard/fix-autostart-exec-path
Fix autostart entry pointing at a non-existent command
This commit is contained in:
@@ -6,6 +6,7 @@ Supports both AppImage and source installations.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
@@ -23,23 +24,32 @@ def is_running_in_appimage() -> bool:
|
||||
|
||||
def get_executable_path() -> str:
|
||||
"""
|
||||
Get the absolute path to the executable.
|
||||
Get the Exec command for the autostart desktop entry.
|
||||
|
||||
For AppImage installations, returns the path to the AppImage file.
|
||||
For source/system installations, detects which executable name is available.
|
||||
For frozen (PyInstaller) builds, returns the path to the binary.
|
||||
For system installations, returns the absolute path of the installed executable.
|
||||
For source installations, returns the current interpreter plus the main script.
|
||||
|
||||
Returns:
|
||||
str: Executable path or command
|
||||
str: Exec command with absolute, quoted paths
|
||||
"""
|
||||
appimage_path = os.getenv("APPIMAGE")
|
||||
if appimage_path:
|
||||
return appimage_path
|
||||
else:
|
||||
for exe_name in ("OneDriveGUI", "onedrivegui"):
|
||||
if shutil.which(exe_name):
|
||||
return exe_name
|
||||
return f'"{appimage_path}"'
|
||||
|
||||
return "OneDriveGUI"
|
||||
if getattr(sys, "frozen", False):
|
||||
return f'"{sys.executable}"'
|
||||
|
||||
for exe_name in ("OneDriveGUI", "onedrivegui"):
|
||||
exe_path = shutil.which(exe_name)
|
||||
if exe_path:
|
||||
return f'"{exe_path}"'
|
||||
|
||||
# Running from source, so no executable exists on PATH. A bare command name
|
||||
# here would produce a desktop entry that silently fails at login.
|
||||
main_script = Path(sys.argv[0]).resolve()
|
||||
return f'"{sys.executable}" "{main_script}"'
|
||||
|
||||
|
||||
def get_autostart_file_path() -> Path:
|
||||
|
||||
Reference in New Issue
Block a user