File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88output_directory = ""
99
1010#################
11- version = "2.0 "
11+ version = "2.01 "
1212
1313helptext = """3dsconv.py ~ version %s
1414https://github.com/ihaveamac/3dsconv
2929 or in the directory specified by --xorpads=<dir>
3030- encrypted and decrypted roms can be converted at the same time"""
3131
32+ cleanup = not "--nocleanup" in sys .argv
33+ verbose = "--verbose" in sys .argv
34+
3235def print_v (msg ):
3336 if verbose :
3437 print (msg )
3538
3639def testcommand (cmd ):
40+ print_v ("- testing: %s" % cmd )
3741 try :
38- proc = subprocess .Popen ([cmd ], stdout = subprocess .PIPE , stderr = subprocess .PIPE ).wait ()
42+ proc = subprocess .Popen ([cmd ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
43+ proc .stdout .close ()
44+ proc .stderr .close ()
45+ proc .wait ()
3946 return True
4047 except OSError as e :
4148 if e .errno != 2 :
@@ -102,9 +109,6 @@ def docleanup(tid):
102109 if not os .path .isdir ("work" ):
103110 raise
104111
105- cleanup = not "--nocleanup" in sys .argv
106- verbose = "--verbose" in sys .argv
107-
108112# probably should've used argparse
109113for arg in sys .argv [1 :]:
110114 if arg [:2 ] != "--" :
@@ -219,6 +223,8 @@ def docleanup(tid):
219223 runcommand (cmds )
220224 os .chdir (".." )
221225
226+ # apparently if the file exists, it will throw an error on Windows
227+ silentremove (os .path .join (output_directory , romname + ".cia" ))
222228 os .rename ("work/%s-game-conv.cia" % tid , os .path .join (output_directory , romname + ".cia" ))
223229 if cleanup :
224230 docleanup (tid )
You can’t perform that action at this time.
0 commit comments