2021-01-20 07:57:24 +00:00
#!/usr/bin/env python3
import sys
import os
import os . path
2021-01-20 09:40:09 +00:00
import argparse
2021-01-20 07:57:24 +00:00
import dds
2021-01-20 09:40:09 +00:00
parser = argparse . ArgumentParser ( description = " Converts any number of files from dds to tga. " )
parser . add_argument ( ' files ' , type = str , nargs = ' * ' , help = " input dds files " )
2021-01-24 03:52:11 +00:00
parser . add_argument ( ' --decompresscmd ' , type = str , metavar = ' CMD ' , default = dds . decompresscmd , help = " name of the nvidia dds decompress tool (default: %(default)s ) " )
2021-01-20 09:40:09 +00:00
args = parser . parse_args ( )
dds . decompresscmd = args . decompresscmd
for argv in args . files :
print ( f ' [ { argv } ]: converting from dds to tga ' )
2021-01-20 07:57:24 +00:00
file = os . path . abspath ( argv )
2021-01-20 09:40:09 +00:00
output = os . path . splitext ( file ) [ 0 ] + f " .tga "
2021-01-20 07:57:24 +00:00
dds . nvdecompress ( file , output )
2021-01-20 10:28:17 +00:00
if os . path . basename ( file ) != os . path . basename ( output ) :
os . remove ( file )