From 62afbffea7fd2d6c421eb73313f65681fc2a6253 Mon Sep 17 00:00:00 2001
From: Alan De Smet <alan.desmet@ssec.wisc.edu>
Date: Mon, 16 Aug 2021 14:52:50 -0500
Subject: [PATCH] add arg_directory; tests valid directory argument
---
example/aitf/argparsetools.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/example/aitf/argparsetools.py b/example/aitf/argparsetools.py
index 6767e67..84e38ef 100644
--- a/example/aitf/argparsetools.py
+++ b/example/aitf/argparsetools.py
@@ -69,6 +69,12 @@ def add_cache_dir_arg(parser):
default=CACHE_DEFAULT
)
+def arg_directory(arg):
+ if not os.path.exists(arg):
+ argerror('The directory "{0}" does not exist'.format(arg))
+ if not os.path.isdir(arg):
+ argerror('The path "{0}" is not a directory'.format(arg))
+ return os.path.abspath(arg)
def arg_valid_cache_dir(arg):
if arg == CACHE_INVALID:
--
GitLab