summaryrefslogtreecommitdiff
path: root/src/leap/util
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-02 02:21:45 +0900
committerkali <kali@leap.se>2012-08-02 02:21:45 +0900
commit23502b72f8cd8a9ec2fd28387f7788aeef54c2d1 (patch)
tree27edd4a91505d7c5e68e694a2cada5da7d0eb8da /src/leap/util
parent6e197c1353c788109df07ee6d1242a5c2327e8f9 (diff)
create config file if not exist.
also locate openvpn binary when building eip configparser defaults. implement half of feature #356
Diffstat (limited to 'src/leap/util')
-rw-r--r--src/leap/util/fileutil.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/util/fileutil.py b/src/leap/util/fileutil.py
index 86a44a89..bb2c243b 100644
--- a/src/leap/util/fileutil.py
+++ b/src/leap/util/fileutil.py
@@ -1,3 +1,4 @@
+import errno
from itertools import chain
import os
import platform
@@ -71,3 +72,16 @@ def which(program):
# sorry bro.
return None
+
+
+def mkdir_p(path):
+ """
+ implements mkdir -p functionality
+ """
+ try:
+ os.makedirs(path)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST:
+ pass
+ else:
+ raise