diff options
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/m5/util/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py index 69f153bb4..591781977 100644 --- a/src/python/m5/util/__init__.py +++ b/src/python/m5/util/__init__.py @@ -176,3 +176,12 @@ def readCommand(cmd, **kwargs): raise return subp.communicate()[0] + +def makeDir(path): + """Make a directory if it doesn't exist. If the path does exist, + ensure that it is a directory""" + if os.path.exists(path): + if not os.path.isdir(path): + raise AttributeError, "%s exists but is not directory" % path + else: + os.mkdir(path) |