mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Use os.mkdirs instead of custom method
This commit is contained in:
parent
85f02c744e
commit
7e3d8ce54b
@ -43,7 +43,7 @@ class Santiago(PagePlugin):
|
|||||||
|
|
||||||
self.santiago_dir = os.path.join(cfg.file_root, "data", "santiago", "tor")
|
self.santiago_dir = os.path.join(cfg.file_root, "data", "santiago", "tor")
|
||||||
self.tor_dir = os.path.join(self.santiago_dir, "general")
|
self.tor_dir = os.path.join(self.santiago_dir, "general")
|
||||||
u.mkdir(self.santiago_dir)
|
os.mkdirs(self.santiago_dir)
|
||||||
os.system( 'chmod a+w %s' % self.santiago_dir)
|
os.system( 'chmod a+w %s' % self.santiago_dir)
|
||||||
hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (self.tor_dir, santiago_port)
|
hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (self.tor_dir, santiago_port)
|
||||||
if hidden_service_config in rc:
|
if hidden_service_config in rc:
|
||||||
|
|||||||
@ -1,26 +1,3 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
def mkdir(newdir):
|
|
||||||
"""works the way a good mkdir should :)
|
|
||||||
- already exists, silently complete
|
|
||||||
- regular file in the way, raise an exception
|
|
||||||
- parent directory(ies) does not exist, make them as well
|
|
||||||
"""
|
|
||||||
if os.path.isdir(newdir):
|
|
||||||
pass
|
|
||||||
elif os.path.isfile(newdir):
|
|
||||||
raise OSError("a file with the same name as the desired " \
|
|
||||||
"dir, '%s', already exists." % newdir)
|
|
||||||
else:
|
|
||||||
head, tail = os.path.split(newdir)
|
|
||||||
if head and not os.path.isdir(head):
|
|
||||||
mkdir(head)
|
|
||||||
#print "mkdir %s" % repr(newdir)
|
|
||||||
if tail:
|
|
||||||
os.mkdir(newdir)
|
|
||||||
|
|
||||||
|
|
||||||
def slurp(filespec):
|
def slurp(filespec):
|
||||||
with open(filespec) as x: f = x.read()
|
with open(filespec) as x: f = x.read()
|
||||||
return f
|
return f
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user