def copyUserDefinedFiles():
# Copy everything in the user directory to the addon directory
infoTrace("vpnproviders.py", "Copying user defined files from userdata directory")
source_path = getUserDataPath((user_def_str)+"/")
dest_path = getAddonPath(True, user_def_str + "/")
# Get the list of connection profiles and another list of strings to abuse for the selection screen
try:
files = getUserDataList(user_def_str, "*")
if len(files) == 0:
errorTrace("vpnproviders.py", "No User Defined files available to copy from " + source_path)
return False
for file in files:
name = file[file.rfind(getSeparator())+1:]
dest_file = dest_path + getSeparator() + name
xbmcvfs.copy(file, dest_file)
if not xbmcvfs.exists(dest_file): raise IOError('Failed to copy user def file ' + file + " to " + dest_file)
return True
except Exception as e:
errorTrace("vpnproviders.py", "Error copying files from " + source_path + " to " + dest_path)
errorTrace("vpnproviders.py", str(e))
return False
评论列表
文章目录