From 831e9b3b7a658663f5bffafef175d4f4a5615cfd Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 5 Jul 2011 18:30:05 -0700 Subject: slicc: cleanup slicc code and make it less verbose --- src/python/m5/util/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/python/m5') 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) -- cgit v1.2.3