Skip to content

Commit 628bbb3

Browse files
committed
stop hanging checking commands, fix for Windows when renaming final CIA
1 parent 08088ca commit 628bbb3

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

3dsconv.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
output_directory = ""
99

1010
#################
11-
version = "2.0"
11+
version = "2.01"
1212

1313
helptext = """3dsconv.py ~ version %s
1414
https://github.com/ihaveamac/3dsconv
@@ -29,13 +29,20 @@
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+
3235
def print_v(msg):
3336
if verbose:
3437
print(msg)
3538

3639
def 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
109113
for 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)

0 commit comments

Comments
 (0)