diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-12 08:51:45 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-09-12 08:51:45 +0200 |
commit | f81cd8de1bc679786579f14c3da28285789b38e1 (patch) | |
tree | 9b7cd6b811e68667f9765c54a345650604749536 /src/ee/tools/__init__.py | |
parent | 7f267c4aabd0a0fc5487bdf962e3c16857137c0c (diff) | |
download | ee-python-f81cd8de1bc679786579f14c3da28285789b38e1.tar.gz ee-python-f81cd8de1bc679786579f14c3da28285789b38e1.tar.bz2 ee-python-f81cd8de1bc679786579f14c3da28285789b38e1.tar.xz ee-python-f81cd8de1bc679786579f14c3da28285789b38e1.zip |
o Implementing kicad-make-bom as a tool.
Diffstat (limited to 'src/ee/tools/__init__.py')
-rw-r--r-- | src/ee/tools/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ee/tools/__init__.py b/src/ee/tools/__init__.py index e69de29..893ee31 100644 --- a/src/ee/tools/__init__.py +++ b/src/ee/tools/__init__.py @@ -0,0 +1,21 @@ +import os.path + + +def _mkdir_and_open(path): + dirname = os.path.dirname(path) + + if len(dirname) > 0: + if not os.path.isdir(dirname): + os.mkdir(dirname) + + return open(path, "w") + + +def mk_parents(path: str): + dirname = os.path.dirname(path) + + if len(dirname) == 0: + return + + if not os.path.isdir(dirname): + os.mkdir(dirname) |