Fix path parts in value substitutions

This commit is contained in:
Oleksii Shevchuk 2016-12-02 19:13:13 +02:00
parent f16f65b66f
commit 2a228b03e1
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ except ImportError:
from os import path, makedirs from os import path, makedirs
from netaddr import IPAddress from netaddr import IPAddress
import platform
class PupyConfig(ConfigParser): class PupyConfig(ConfigParser):
def __init__(self, config='pupy.conf'): def __init__(self, config='pupy.conf'):
@ -36,6 +37,9 @@ class PupyConfig(ConfigParser):
retfolder = path.join(self.user_root, folder) retfolder = path.join(self.user_root, folder)
for key, value in substitutions.iteritems(): for key, value in substitutions.iteritems():
value = value.replace('/', '_').replace('..', '_')
if platform.system == 'Windows':
value = value.replace(':', '_')
retfolder = retfolder.replace(key, value) retfolder = retfolder.replace(key, value)
if path.isdir(retfolder): if path.isdir(retfolder):