1- import os , subprocess , platform , shutil , tarfile , zipfile , yaml , sys , requests
1+ import os , subprocess , platform , shutil , tarfile , zipfile , yaml , sys , requests , ctypes
22
33def main ():
44 # Detect the operating system and architecture to select the correct binary for ascii-image-converter
@@ -40,6 +40,11 @@ def main():
4040 # Detect the architecture and the OS, set the release name
4141 match system :
4242 case 'WINDOWS' :
43+ if os .getuid () == 0 :
44+ print ("Running as administrator." )
45+ else :
46+ print ("Please run the program with administrator rights for setup." )
47+ sys .exit (1 )
4348 useFile = True
4449 match machine :
4550 case 'AMD64' | 'X86_64' :
@@ -118,6 +123,7 @@ def main():
118123 print ("Error extracting file: Unsupported file format." )
119124 sys .exit (1 )
120125
126+
121127 # Check if the operating system is not Windows
122128 if system != 'WINDOWS' :
123129 if system == 'LINUX' : # Assign the platform to match the binary name
@@ -133,6 +139,12 @@ def main():
133139 except Exception as e :
134140 print (f"Failed to move binaries: { e } " )
135141 sys .exit (1 )
142+ else :
143+ os .makedirs ("C:\\ Program Files\\ TheZoraiz\\ ascii-image-converter" )
144+ os .makedirs ("C:\\ Program Files\\ widkit\\ greetings" )
145+ binary_path = os .path .join (extract_dir , releaseName .replace ('.zip' , '.exe' ), 'ascii-image-converter' )
146+ subprocess .run ([ "mv" , binary_path , "C:\\ Program Files\\ TheZoraiz\\ ascii-image-converter" ], check = True )
147+ subprocess .run ([ "cp" , "greetings-windows" , "C:\\ Program Files\\ widkit\\ greetings\\ greetings.exe" ], check = True )
136148
137149 # Cleanup
138150 print ("Cleaning up..." )
0 commit comments