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

Issue 696: create the output dir if does not exist #697

Merged
merged 7 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
2024-07-15 Jan Kotanski <jankotan@gmail.com>
* create output dir is does not exists (#696)
* fix ScanFileinScanNameDir name to ScanNames (#694)
* fix support for ScanNames=False (#695)
* tagged as v4.11.1

2024-07-15 Jan Kotanski <jankotan@gmail.com>
* fix ScanFileinScanNameDir name to ScanNames (#694)
* tagged as v4.11.1
* tagged as v4.12.0

2024-07-11 Jan Kotanski <jankotan@gmail.com>
* add --online-xml-file option for nxscreate stdcomp (#687)
Expand Down
20 changes: 20 additions & 0 deletions nxstools/nxsfileinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,9 @@ def show(self, root, options):
metadata = self.metadata(root, options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down Expand Up @@ -3013,6 +3016,8 @@ def groupmetadata(cls, options):
elif options.group and options.group[0]:
if imfile:
metadir, _ = os.path.split(os.path.abspath(imfile))
if not os.path.isdir(metadir):
os.makedirs(metadir, exist_ok=True)
omfile = os.path.join(
metadir, "%s.scan.json" % options.group[0])
if options.writefiles:
Expand Down Expand Up @@ -3173,6 +3178,9 @@ def show(self, options):
metadata, datablocks, attachments = self.groupmetadata(options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down Expand Up @@ -3517,6 +3525,9 @@ def show(self, options):
metadata = self.datablock(options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down Expand Up @@ -3687,6 +3698,9 @@ def show(self, options):
metadata = self.sample(options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down Expand Up @@ -4573,6 +4587,9 @@ def show(self, root, options):
metadata = self.attachment(root, options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down Expand Up @@ -4731,6 +4748,9 @@ def show(self, options):
metadata = self.instrument(options)
if metadata:
if options.output:
fdir, fn = os.path.split(os.path.abspath(options.output))
if not os.path.isdir(fdir):
os.makedirs(fdir, exist_ok=True)
chmod = None
try:
chmod = int(options.chmod, 8)
Expand Down
Loading