Commit 0252f2be authored by dylan grafmyre's avatar dylan grafmyre
Browse files

windows is crazy

parent 7ce48cd4
......@@ -3,26 +3,48 @@
import argparse
import os
import logging
import sys
import pyvmf
LOGGER = logging.getLogger(os.path.basename(__file__))
def file_type(*args, **kwargs):
def _(name):
if name == '-':
if 'w' in args[0]:
return sys.stdout.buffer
if 'r' in args[0]:
return sys.stdin.buffer
try:
fh = open(name, *args, **kwargs)
return fh
except Exception as err:
LOGGER.exception('%r', err)
raise
return _
write_normal = file_type('w', newline='\n')
ARGP = argparse.ArgumentParser()
ARGP.add_argument('vmf', type=argparse.FileType())
ARGP.add_argument('--pack-used-local', action='store_true')
ARGP.add_argument('--verbose', '-v', action='store_true')
ARGP.add_argument('--list', '--ls', '-l', action='store_true')
ARGP.add_argument('--output', type=write_normal, default=write_normal('-'))
def emit_item(argp, path):
if not os.path.exists(path):
raise RuntimeWarning('file missing: %r', path)
if argp.list:
print(path)
argp.output.write(path.encode())
argp.output.write(b'\n')
else:
# bspzip src\ndst\n pairs
print(path)
print(path)
argp.output.write(path.encode())
argp.output.write(b'\n')
argp.output.write(path.encode())
argp.output.write(b'\n')
def emit_material(argp, name, dedupe):
material_lower = 'materials/{}'.format(name.lower())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment