Merge pull request #1 from digarok/master

replace '.dsk' extension instead of append
This commit is contained in:
Paul Hagstrom 2020-03-13 20:21:16 -04:00 committed by GitHub
commit 1f151de479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,7 @@
#!/usr/bin/env python3
# unscramble dsk into po
# Paul Hagstrom, Dec 2015
import sys
import getopt
import sys, getopt, re
def main(argv=None):
print("dsk2po - convert dsk files to po files")
@ -23,7 +22,7 @@ def main(argv=None):
for track in range(35):
trackbuffer = dskfile.read(4096)
potracks.append(dsk2po(trackbuffer))
pofilename = dskfilename + '.po'
pofilename = re.sub('\.dsk$', '', dskfilename, flags=re.IGNORECASE) + ".po"
print('Writing po image to {}'.format(pofilename))
with open(pofilename, mode="wb") as pofile:
for potrack in potracks:
@ -54,4 +53,4 @@ def dsk2po(trackbuffer):
return potrack
if __name__ == "__main__":
sys.exit(main())
sys.exit(main())