diff --git a/SublimeZilla.py b/SublimeZilla.py old mode 100755 new mode 100644 index a63d0a3..249098a --- a/SublimeZilla.py +++ b/SublimeZilla.py @@ -1,9 +1,11 @@ import sublime, sublime_plugin import shutil -import base64 +import base64 import os import re -import binascii +import binascii + +from sys import platform as _platform from xml.dom import minidom @@ -132,8 +134,12 @@ def get_xml(self): if not os.path.exists(default_xml): default_xml = user_home + os.sep + "Application Data\\FileZilla\\sitemanager.xml" - elif os.name == 'posix': + elif _platform == "linux" or _platform == "linux2": + # Linux default_xml = user_home + os.sep + ".filezilla/sitemanager.xml" + elif _platform == "darwin": + # OS X + default_xml = user_home + os.sep + ".config/filezilla/sitemanager.xml" settings = sublime.load_settings("SublimeZilla.sublime-settings") path = settings.get("filezilla_db_path", default_xml) @@ -211,23 +217,23 @@ def get_server_entries(self): Pass = server.getElementsByTagName('Pass') if len(Pass) > 0 and Pass[0].firstChild is not None: PassVal = Pass[0].firstChild.nodeValue - - # Try base64 decode... - PassVal = str(PassVal) - PassValTmp = "" - - try: - PassValTmp = base64.b64decode(PassVal).decode('utf-8') - PassValTmp = str(PassValTmp) - except TypeError: - # Is probably not encoded, use what we had - PassValTmp = PassVal - except binascii.Error: - # Is probably not encoded, use what we had - PassValTmp = PassVal - - server_obj["password"] = PassValTmp - + + # Try base64 decode... + PassVal = str(PassVal) + PassValTmp = "" + + try: + PassValTmp = base64.b64decode(PassVal).decode('utf-8') + PassValTmp = str(PassValTmp) + except TypeError: + # Is probably not encoded, use what we had + PassValTmp = PassVal + except binascii.Error: + # Is probably not encoded, use what we had + PassValTmp = PassVal + + server_obj["password"] = PassValTmp + else: server_obj["password"] = ""