From be643563a5f9f5a1adadbaec306431bab972ebd6 Mon Sep 17 00:00:00 2001 From: pravic Date: Thu, 18 Feb 2016 12:33:47 +0300 Subject: [PATCH] host: normalize path for load_file() - sciter prefers a full path of main document to resolve subrsources properly --- sciter/host.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sciter/host.py b/sciter/host.py index 8e7d364..f92a00c 100644 --- a/sciter/host.py +++ b/sciter/host.py @@ -1,6 +1,7 @@ """Sciter host application helpers.""" import ctypes +import os.path import sciter.value from sciter.scdef import * @@ -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)