Skip to content

Commit 360d78a

Browse files
committed
changed config directory for better compatibility
1 parent 63145b1 commit 360d78a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

nord_nm_gui.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def __init__(self):
2424
super(MainWindow, self).__init__()
2525
self.setObjectName("MainWindowObject")
2626
self.setWindowIcon(QtGui.QIcon('nordvpnicon.png'))
27-
self.config_path = os.path.join(os.path.abspath(os.getcwd()), '.configs')
28-
self.scripts_path = os.path.join(os.path.abspath(os.getcwd()), '.scripts')
27+
self.base_dir = os.path.join(os.path.abspath(os.path.expanduser('~')), '.nordnmconfigs')
28+
self.config_path = os.path.join(os.path.abspath(self.base_dir), '.configs')
29+
self.scripts_path = os.path.join(os.path.abspath(self.base_dir), '.scripts')
2930
self.network_manager_path = '/etc/NetworkManager/dispatcher.d/'
3031
self.conf_path = os.path.join(self.config_path, 'nord_settings.conf')
3132
self.config = configparser.ConfigParser()
@@ -292,6 +293,8 @@ def login_ui(self):
292293

293294
def check_configs(self):
294295
try:
296+
if not os.path.isdir(self.base_dir):
297+
os.mkdir(self.base_dir)
295298
if not os.path.isdir(self.config_path):
296299
os.mkdir(self.config_path)
297300
if not os.path.isdir(self.scripts_path):
@@ -442,7 +445,7 @@ def get_ovpn(self):
442445
ovpn_url = tcp_xor_url
443446
elif (self.server_type_select.currentText() != 'Obfuscated Server') and (self.connection_type_select.currentText() == 'UDP'):
444447
ovpn_url = udp_url
445-
elif (self.server_type_select.currentText() != 'Obfuscated Server') and (self.connection_type_select.currentText() =='TCP'):
448+
elif (self.server_type_select.currentText() != 'Obfuscated Server') and (self.connection_type_select.currentText() == 'TCP'):
446449
ovpn_url = tcp_url
447450

448451
if self.connection_type_select.currentText() == 'UDP':
@@ -471,8 +474,8 @@ def import_ovpn(self):
471474
self.repaint()
472475
self.connection_name = self.generate_connection_name()
473476
ovpn_file = self.connection_name + '.ovpn'
474-
path = os.path.join(self.config_path, ovpn_file)
475-
shutil.copy(self.ovpn_path, os.path.join(path))
477+
path = os.path.join(self.config_path, ovpn_file) #changes name from default
478+
shutil.copy(self.ovpn_path, path)
476479
os.remove(self.ovpn_path)
477480
output = subprocess.run(['nmcli', 'connection', 'import', 'type', 'openvpn', 'file', path])
478481
output.check_returncode()

0 commit comments

Comments
 (0)