From dab8244ef0d5a7c1e26ca04c2364ed64d362126d Mon Sep 17 00:00:00 2001 From: Nick Wilde Date: Sun, 8 Jun 2014 08:07:22 -0700 Subject: [PATCH] Windows Support Makes it work on Windows (if you give it the right path in the new executable setting of course) --- markmon.py | 10 ++++++++-- sublime-text-markmon.sublime-settings | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/markmon.py b/markmon.py index a935769..b449e4e 100644 --- a/markmon.py +++ b/markmon.py @@ -65,6 +65,7 @@ def __init__(self): def update(self, settings): self.settings = { + "executable": settings.get("executable", 'markmon'), "port": settings.get("port", 3000), "command": settings.get("command", "pandoc -t HTML5"), "stylesheet": settings.get("stylesheet", None), @@ -74,7 +75,7 @@ def update(self, settings): def build_strings(self): self.client_url = "localhost:{:d}".format(self.settings['port']) - self.server_command = ['markmon', + self.server_command = [self.settings["executable"], "--port", str(self.settings['port']), "--command", self.settings['command']] if self.settings['stylesheet']: @@ -125,7 +126,12 @@ def setup_server(self, _=None): env = os.environ.copy() betterenv = util.create_environment() env["PATH"] = betterenv["PATH"] - subprocess.Popen(self.settings.server_command, env=env) + try: + subprocess.Popen(self.settings.server_command, env=env) + except FileNotFoundError as e: + print("Markmon Server failed to initialize. Confirm executable path is correct in Markmon Setting. Command used:") + print(self.settings.server_command) + raise def cleanup_server(self): if self.server_url: diff --git a/sublime-text-markmon.sublime-settings b/sublime-text-markmon.sublime-settings index be6eda0..5cb62b3 100644 --- a/sublime-text-markmon.sublime-settings +++ b/sublime-text-markmon.sublime-settings @@ -1,4 +1,7 @@ { + //On Windows try "markmon.cmd" if you get errors. + //If markmon is not on your path you'll need to use a full path to it + "executable": "markmon", "port": 3002, "command": "pandoc -t HTML5 --mathjax", "stylesheet": null,