Skip to content
Snippets Groups Projects
Commit fc796b97 authored by Dicson's avatar Dicson
Browse files

PluginInstaller. fix install(update)

parent 1995f71f
No related branches found
No related tags found
No related merge requests found
...@@ -424,7 +424,8 @@ class PluginInstaller(GajimPlugin): ...@@ -424,7 +424,8 @@ class PluginInstaller(GajimPlugin):
file_path)) file_path))
# read metadata from manifest.ini # read metadata from manifest.ini
conf.readfp(open(manifest_path, 'r')) with open(manifest_path) as _file:
conf.read_file(_file)
for option in fields: for option in fields:
if conf.get('info', option) is '': if conf.get('info', option) is '':
raise configparser.NoOptionError('field empty') raise configparser.NoOptionError('field empty')
...@@ -582,7 +583,7 @@ class Ftp(threading.Thread): ...@@ -582,7 +583,7 @@ class Ftp(threading.Thread):
else: else:
files.append(i[1:]) files.append(i[1:])
dirs, files = [], [] dirs, files = [], []
nlstr('/plugins/' + remote_dir) nlstr('/plugins_gtk3/' + remote_dir)
base_dir, user_dir = gajim.PLUGINS_DIRS base_dir, user_dir = gajim.PLUGINS_DIRS
if not os.path.isdir(user_dir): if not os.path.isdir(user_dir):
...@@ -605,14 +606,16 @@ class Ftp(threading.Thread): ...@@ -605,14 +606,16 @@ class Ftp(threading.Thread):
for filename in files: for filename in files:
GObject.idle_add(self.progressbar.set_text, GObject.idle_add(self.progressbar.set_text,
_('Downloading "%s"') % filename) _('Downloading "%s"') % filename)
full_filename = os.path.join(local_dir, filename) full_filename = os.path.join(local_dir, filename.replace(
'plugins_gtk3', 'plugins'))
try: try:
file_ = open(full_filename, 'wb') file_ = open(full_filename, 'wb')
self.ftp.retrbinary('RETR /%s' % filename, self.ftp.retrbinary('RETR /%s' % filename,
file_.write) file_.write)
file_.close() file_.close()
except ftplib.error_perm: except ftplib.all_errors as e:
print('ERROR: cannot read file "%s"' % filename) print (str(e))
os.unlink(filename) os.unlink(filename)
self.ftp.quit() self.ftp.quit()
GObject.idle_add(self.window.emit, 'plugin_downloaded', GObject.idle_add(self.window.emit, 'plugin_downloaded',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment