Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

args.sidecars fixes #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions file_mapper_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,33 +208,37 @@ def parse_data(contents, verbose=False, testdebug=False):
elif args.overwrite:
do_action(source, destination, args.action,
overwrite=args.overwrite, testdebug=args.testdebug, relsym=args.relative_symlink)
if args.sidecars:
if args.sidecars and ( source.endswith('.nii') or source.endswith('.nii.gz') ):
json_src, json_dest = map_sidecars(source, destination)
do_action(json_src, json_dest, args.action,
testdebug=args.testdebug,
relsym=args.relative_symlink)
if os.path.isfile(json_src):
do_action(json_src, json_dest, args.action,
overwrite=args.overwrite,
testdebug=args.testdebug,
relsym=args.relative_symlink)
if verbose:
print("File has been overwritten")
elif os.path.exists(dirname):
if verbose:
print("Path already exists: " + str(dirname))
elif os.path.isdir(os.path.dirname(destination)):
do_action(source, destination, args.action, testdebug=args.testdebug, relsym=args.relative_symlink)
if args.sidecars:
if args.sidecars and ( source.endswith('.nii') or source.endswith('.nii.gz') ):
json_src, json_dest = map_sidecars(source, destination)
do_action(json_src, json_dest, args.action,
testdebug=args.testdebug,
relsym=args.relative_symlink)
if os.path.isfile(json_src):
do_action(json_src, json_dest, args.action,
testdebug=args.testdebug,
relsym=args.relative_symlink)
else:
os.makedirs( dirname )
if verbose:
print("Path has been made: " + str(dirname))
do_action(source, destination, args.action, testdebug=args.testdebug, relsym=args.relative_symlink)
if args.sidecars:
if args.sidecars and ( source.endswith('.nii') or source.endswith('.nii.gz') ):
json_src, json_dest = map_sidecars(source, destination)
do_action(json_src, json_dest, args.action,
testdebug=args.testdebug,
relsym=args.relative_symlink)
if os.path.isfile(json_src):
do_action(json_src, json_dest, args.action,
testdebug=args.testdebug,
relsym=args.relative_symlink)



Expand Down