fix when Filname > 17 first copy file after rename
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# Wireguard functions for Wire-Py
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
from tkinter import filedialog
|
||||
import tkinter as tk
|
||||
|
||||
@ -182,14 +182,15 @@ class ImportTunnel:
|
||||
pathsplit1 = pathsplit[-1]
|
||||
if "PrivateKey = " in read and "PublicKey = " in read:
|
||||
if len(pathsplit1) > 17:
|
||||
p1 = shutil.copy(filepath, os.environ['HOME'] + '/tester/')
|
||||
pathsplit = pathsplit1[len(pathsplit1) - 17:]
|
||||
os.rename(filepath, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
||||
os.rename(p1, os.environ['HOME'] + '/tester/' + str(pathsplit))
|
||||
if self.a != '':
|
||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||
os.system('nmcli connection import type wireguard file ' + os.environ['HOME'] + '/tester/' +
|
||||
str(pathsplit))
|
||||
else:
|
||||
subprocess.call('cp ' + str(filepath) + ' ' + os.environ['HOME'] + '/tester/', shell=True)
|
||||
shutil.copy(filepath, os.environ['HOME'] + '/tester/')
|
||||
if self.a != '':
|
||||
os.system('nmcli connection down ' + str(TunnelActiv.active()))
|
||||
os.system('nmcli connection import type wireguard file ' + str(filepath))
|
||||
|
Reference in New Issue
Block a user