File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import stat
77import platform
88import sys
9+ import winshell
910
1011# === CONFIGURATION ===
1112TARGET_DIR = os .path .expanduser ("~/Documents/mc" )
@@ -95,6 +96,31 @@ def main():
9596 inner_folder = get_inner_folder (extract_path )
9697 copy_and_replace (inner_folder , TARGET_DIR )
9798 create_run_scripts (TARGET_DIR )
99+ ICON = os .path .join (TARGET_DIR , "logo.ico" )
100+ if platform .system () == "Windows" :
101+ winshell .shortcut (
102+ os .path .join (TARGET_DIR , "run.bat" ),
103+ TARGET_DIR ,
104+ "Minecraft Launcher" ,
105+ ICON ,
106+ "Minecraft Launcher"
107+ )
108+ elif platform .system () == "Linux" :
109+ # Create a .desktop file for Linux
110+ desktop_file_path = os .path .join (os .path .expanduser ("~/.local/share/applications" ), "minecraft-launcher.desktop" )
111+ with open (desktop_file_path , "w" ) as f :
112+ f .write (f"""[Desktop Entry]
113+ Name=Minecraft Launcher
114+ Exec={ os .path .join (TARGET_DIR , "run.sh" )}
115+ Type=Application
116+ Icon={ ICON }
117+ Terminal=false
118+ StartupNotify=false
119+ """ )
120+ print (f"Desktop entry created at { desktop_file_path } " )
121+ else :
122+ print ("Unsupported OS for creating shortcuts. Please create a shortcut manually." )
123+ print (f"Launcher installed to { TARGET_DIR } ." )
98124
99125if __name__ == "__main__" :
100126 main ()
Original file line number Diff line number Diff line change 11requests
2- pyinstaller
2+ pyinstaller
3+ winshell
You can’t perform that action at this time.
0 commit comments