os.path.sep
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DESKTOP-DPA61F8\Benedek 2021-04-18 22:53:38 +02:00
parent 094c1bcf35
commit c8c1b560e8

View File

@ -83,7 +83,7 @@ class Authetication:
##Save private key in separate file ##Save private key in separate file
user_privatekey = {'passphrase': user_passphrase, 'privateClientKey': private_key_value, 'publicServerKey': public_server_key} user_privatekey = {'passphrase': user_passphrase, 'privateClientKey': private_key_value, 'publicServerKey': public_server_key}
with open(self.PRIVATE_KEY_DIRECTORY_LOCATION + '\\' + str(data['index']) + '.txt', 'w+') as outfile: with open(self.PRIVATE_KEY_DIRECTORY_LOCATION + os.path.sep + str(data['index']) + '.txt', 'w+') as outfile:
json.dump(user_privatekey, outfile) json.dump(user_privatekey, outfile)
##Save public key in users ##Save public key in users
@ -110,7 +110,7 @@ class Authetication:
auth_logger.debug("User NOT saved! This username already exists!") auth_logger.debug("User NOT saved! This username already exists!")
return False return False
else: else:
if not os.path.isdir(self.HOME_DIRECTORY_LOCATION + "\\" + str(data['index'] + 1)): if not os.path.isdir(self.HOME_DIRECTORY_LOCATION + os.path.sep + str(data['index'] + 1)):
data['index'] = data['index'] + 1 data['index'] = data['index'] + 1
user = { user = {
'username': username, 'username': username,
@ -120,7 +120,7 @@ class Authetication:
} }
##Create user HOME directory with index as name ##Create user HOME directory with index as name
os.mkdir(self.HOME_DIRECTORY_LOCATION + '\\' + str(data['index'])) os.mkdir(self.HOME_DIRECTORY_LOCATION + os.path.sep + str(data['index']))
##Save user data ##Save user data
data['user'].append(user) data['user'].append(user)