Skip to content

Commit

Permalink
host: normalize path for load_file() - sciter prefers a full path of …
Browse files Browse the repository at this point in the history
…main document to resolve subrsources properly
  • Loading branch information
pravic committed Feb 18, 2016
1 parent a019235 commit be64356
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sciter/host.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Sciter host application helpers."""

import ctypes
import os.path
import sciter.value

from sciter.scdef import *
Expand Down Expand Up @@ -89,8 +90,10 @@ def get_hwnd(self) -> HWINDOW:
"""Get window handle."""
return self.hwnd

def load_file(self, uri: str):
def load_file(self, uri: str, normalize=True):
"""Load HTML document from file."""
if normalize and not ":" in uri:
uri = "file://" + os.path.abspath(uri).replace("\\", "/")
ok = _api.SciterLoadFile(self.hwnd, uri)
if not ok:
raise sciter.SciterError("Unable to load file " + uri)
Expand Down

0 comments on commit be64356

Please sign in to comment.