Skip to content

Commit

Permalink
Windows Support
Browse files Browse the repository at this point in the history
Makes it work on Windows (if you give it the right path in the new
executable setting of course)
  • Loading branch information
NickDickinsonWilde committed Jun 8, 2014
1 parent ff95dde commit dab8244
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions markmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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']:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions sublime-text-markmon.sublime-settings
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit dab8244

Please sign in to comment.