From c481a9e6f3a3eabcacf1b9fcc4415157e488afd6 Mon Sep 17 00:00:00 2001 From: Kistras <81854722+Kistras@users.noreply.github.com> Date: Sat, 2 Oct 2021 17:52:34 +0500 Subject: [PATCH 1/2] Now works properly Creates "?Datalist" files and alike --- tool.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tool.py b/tool.py index 8633878..f2912b6 100644 --- a/tool.py +++ b/tool.py @@ -67,6 +67,7 @@ def cli(ctx, verbose): ctx.ensure_object(dict) ctx.obj['VERBOSE'] = verbose +forbiddensymb = [":", "*", "?", ">", "<", "|", "+"] @cli.command() @click.argument('hoggfile', type=click.Path(exists=True)) @click.argument('glob', required=False) @@ -80,6 +81,8 @@ def extract(ctx,hoggfile,glob,out_dir): for i, f in enumerate(bar): if f.flag_fffe == FLAG_FFFE: fn = os.path.join(out_dir,hogg.get_file_name(i)) + for sym in forbiddensymb: + fn = fn.replace(sym, "") if glob and not pathlib.PurePath(fn).match(glob): if ctx.obj['VERBOSE']: click.echo(f"skipping {fn}") continue From 27de5c3c887008c0a08366a71920e803ab882c49 Mon Sep 17 00:00:00 2001 From: Kistras <81854722+Kistras@users.noreply.github.com> Date: Thu, 1 Dec 2022 02:50:59 +0500 Subject: [PATCH 2/2] Update tool.py --- tool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool.py b/tool.py index f2912b6..a2e2193 100644 --- a/tool.py +++ b/tool.py @@ -67,7 +67,7 @@ def cli(ctx, verbose): ctx.ensure_object(dict) ctx.obj['VERBOSE'] = verbose -forbiddensymb = [":", "*", "?", ">", "<", "|", "+"] +forbiddensymb = ["%", ":", "*", "?", ">", "<", "|", "+"] # "%" has to go first, otherwise you might replace it in wrong places/more than once @cli.command() @click.argument('hoggfile', type=click.Path(exists=True)) @click.argument('glob', required=False) @@ -81,8 +81,8 @@ def extract(ctx,hoggfile,glob,out_dir): for i, f in enumerate(bar): if f.flag_fffe == FLAG_FFFE: fn = os.path.join(out_dir,hogg.get_file_name(i)) - for sym in forbiddensymb: - fn = fn.replace(sym, "") + for k, sym in enumerate(forbiddensymb): + fn = fn.replace(sym, f"%{k}") if glob and not pathlib.PurePath(fn).match(glob): if ctx.obj['VERBOSE']: click.echo(f"skipping {fn}") continue