From d0bb54b229b8ffc19d1a41359b22eeae06fc77c0 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 1 Apr 2019 00:40:47 -0400 Subject: make qsettings match on non-macos platforms and craete snippet folder if missing --- python/examples/snippets/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/examples/snippets/__init__.py b/python/examples/snippets/__init__.py index d393b4d9..32f2f8eb 100644 --- a/python/examples/snippets/__init__.py +++ b/python/examples/snippets/__init__.py @@ -16,6 +16,12 @@ from binaryninja.log import (log_info, log_warn, log_alert, log_debug) from binaryninjaui import (getMonospaceFont, UIAction, UIActionHandler, Menu) snippetPath = os.path.realpath(os.path.join(user_plugin_path(), "..", "snippets")) +try: + if not os.path.exists(snippetPath): + os.mkdir(snippetPath) +except IOError: + log_error("Unable to create %s" % snippetPath) + def includeWalk(dir, includeExt): filePaths = [] @@ -152,7 +158,7 @@ class Snippets(QDialog): hlayout.addWidget(hsplitter) self.showNormal() #Fixes bug that maximized windows are "stuck" - self.settings = QSettings("Vector35", "Snippet Editor") + self.settings = QSettings("Vector 35", "Snippet Editor") if self.settings.contains("ui/snippeteditor/geometry"): self.restoreGeometry(self.settings.value("ui/snippeteditor/geometry")) else: -- cgit v1.3.1