mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 15:59:48 -05:00
Fixed crash in Windows, related to HS directory path and slashes
This commit is contained in:
parent
d67d5010d1
commit
e60a82ad22
@ -95,19 +95,21 @@ class HS(object):
|
||||
else:
|
||||
# come up with a hidden service directory name
|
||||
if helpers.get_platform() == 'Windows':
|
||||
path = '{0:s}/onionshare'.format(os.environ['Temp'].replace('\\', '/'))
|
||||
self.hidserv_dir = tempfile.mkdtemp()
|
||||
self.hidserv_dir = self.hidserv_dir.replace('\\', '/')
|
||||
|
||||
else:
|
||||
path = '/tmp/onionshare'
|
||||
try:
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path, 0700)
|
||||
except:
|
||||
raise HSDirError(strings._("error_hs_dir_cannot_create").format(path))
|
||||
if not os.access(path, os.W_OK):
|
||||
raise HSDirError(strings._("error_hs_dir_not_writable").format(path))
|
||||
|
||||
try:
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path, 0700)
|
||||
except:
|
||||
raise HSDirError(strings._("error_hs_dir_cannot_create").format(path))
|
||||
if not os.access(path, os.W_OK):
|
||||
raise HSDirError(strings._("error_hs_dir_not_writable").format(path))
|
||||
self.hidserv_dir = tempfile.mkdtemp(dir=path)
|
||||
|
||||
self.hidserv_dir = tempfile.mkdtemp(dir=path)
|
||||
self.cleanup_filenames.append(self.hidserv_dir)
|
||||
|
||||
# set up hidden service
|
||||
|
Loading…
Reference in New Issue
Block a user