Skip to content

Commit

Permalink
Fix removing old startup shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed Nov 20, 2023
1 parent 36e0262 commit 4f6d1c6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Music Caster by Elijah Lopez Changelog

5.16.1
- [Fix] Remove old startup shortcuts + background thread

5.16.0
- [Fix] Linux?
- [Feature] Linux support
- [Fix] Remove old startup shortcuts

5.15.0
Expand Down
8 changes: 4 additions & 4 deletions build_files/mc_version_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# noinspection PyUnresolvedReferences
VSVersionInfo(
ffi=FixedFileInfo(
prodvers=(5, 16, 0, 0),
filevers=(5, 16, 0, 0),
prodvers=(5, 16, 1, 0),
filevers=(5, 16, 1, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x17,
# Contains a bitmask that specifies the Boolean attributes of the file.
Expand All @@ -28,12 +28,12 @@ VSVersionInfo(
'000004b0',
[StringStruct('CompanyName', 'Elijah Lopez'),
StringStruct('FileDescription', 'Music Caster'),
StringStruct('FileVersion', '5.16.0.0'),
StringStruct('FileVersion', '5.16.1.0'),
StringStruct('InternalName', 'Music Caster'),
StringStruct('LegalCopyright', 'Copyright (c) 2019 - 2023, Elijah Lopez'),
StringStruct('OriginalFilename', 'Music Caster.exe'),
StringStruct('ProductName', 'Music Caster'),
StringStruct('ProductVersion', '5.16.0.0')])
StringStruct('ProductVersion', '5.16.1.0')])
]),
VarFileInfo([VarStruct('Translation', [0, 1200])])
]
Expand Down
7 changes: 6 additions & 1 deletion build_files/setup_script.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "Music Caster"
#define MyAppVersion "5.16.0"
#define MyAppVersion "5.16.1"
#define MyAppPublisher "Elijah Lopez"
#define MyAppURL "https://elijahlopez.ca/software#music-caster"
#define MyAppExeName "Music Caster.exe"
Expand Down Expand Up @@ -63,6 +63,11 @@ Type: filesandordirs; Name: {app}\PyQt5
Type: filesandordirs; Name: {app}\wx
Type: filesandordirs; Name: {app}\vlc
Type: filesandordirs; Name: {app}\vlc_lib
Type: filesandordirs; Name: {app}\importlib_metadata*
Type: filesandordirs; Name: {app}\keyring*
Type: filesandordirs; Name: {app}\lz4*
Type: filesandordirs; Name: {app}\websockets*
Type: filesandordirs; Name: {app}\wheel*

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Expand Down
2 changes: 1 addition & 1 deletion src/meta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = latest_version = '5.16.0'
VERSION = latest_version = '5.16.1'
UPDATE_MESSAGE = """
[NEW] Bienvenue Français
[MSG] Language translators wanted
Expand Down
4 changes: 4 additions & 0 deletions src/music_caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3548,8 +3548,12 @@ def read_main_window():
def start_on_login_modifications():
""" Run platform specific implementation of startup modification """
if platform.system() == 'Windows':
app_log.info('removing old startup shortcuts')
rm_old_startup_shortcuts()
app_log.info('removed old startup shortcuts')
app_log.info('creating/removing startup registry entry')
start_on_login_win32(working_dir, settings['run_on_startup'])
app_log.info('created/removed startup registry entry')
else:
print('TODO: start_on_login_modifications not implemented for', platform.system())

Expand Down
13 changes: 7 additions & 6 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,12 +1382,13 @@ def start_on_login_win32(working_dir, create_key=True, is_debug=True):


def rm_old_startup_shortcuts():
from win32comext.shell import shell, shellcon
startup_dir = shell.SHGetFolderPath(0, (shellcon.CSIDL_STARTUP, shellcon.CSIDL_COMMON_STARTUP)[0], None, 0)
shortcut_paths = (f"{startup_dir}\\{item}.lnk" for item in ('Music Caster', 'Music Caster (Python)', 'Music Caster [DEBUG]'))
for shortcut_path in shortcut_paths:
with suppress(FileNotFoundError):
os.remove(shortcut_path)
if platform.system() == 'Windows':
from knownpaths import sh_get_known_folder_path, FOLDERID
startup_dir = sh_get_known_folder_path(FOLDERID.Startup)
shortcut_paths = (f"{startup_dir}\\{item}.lnk" for item in ('Music Caster', 'Music Caster (Python)', 'Music Caster [DEBUG]'))
for shortcut_path in shortcut_paths:
with suppress(FileNotFoundError):
os.remove(shortcut_path)


def startfile(file):
Expand Down

0 comments on commit 4f6d1c6

Please sign in to comment.