Skip to content

Commit

Permalink
Issue 696: create the output dir if does not exist (#697)
Browse files Browse the repository at this point in the history
* fix support for ScanNames=False

* apply pep8

* update for the fix

* update for the fix

* update Changelog

* update config
  • Loading branch information
jkotan authored Jul 16, 2024
1 parent 50910c2 commit 406643b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
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

0 comments on commit 406643b

Please sign in to comment.