summaryrefslogtreecommitdiffstats
path: root/pyuno
diff options
context:
space:
mode:
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/zipcore/python.cxx9
-rw-r--r--pyuno/zipcore/python.sh4
2 files changed, 13 insertions, 0 deletions
diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx
index 412f75a84598..355921805dbb 100644
--- a/pyuno/zipcore/python.cxx
+++ b/pyuno/zipcore/python.cxx
@@ -91,6 +91,15 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
exit(EXIT_FAILURE);
}
wchar_t * pathEnd = tools::filename(path);
+ *pathEnd = L'\0';
+ n = GetEnvironmentVariableW(L"UNO_PATH", NULL, 0);
+ if (n == 0) {
+ if (GetLastError() != ERROR_ENVVAR_NOT_FOUND ||
+ !SetEnvironmentVariableW(L"UNO_PATH", path))
+ {
+ exit(EXIT_FAILURE);
+ }
+ }
wchar_t bootstrap[MY_LENGTH(L"vnd.sun.star.pathname:") + MAX_PATH] =
L"vnd.sun.star.pathname:"; //TODO: overflow
wchar_t * bootstrapEnd = tools::buildPath(
diff --git a/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh
index 5195f68e24aa..199ed9c0eadb 100644
--- a/pyuno/zipcore/python.sh
+++ b/pyuno/zipcore/python.sh
@@ -51,6 +51,10 @@ export PATH
LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
+# Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable:
+: ${UNO_PATH=$sd_prog}
+export UNO_PATH
+
# Set URE_BOOTSTRAP so that "uno.getComponentContext()" bootstraps a complete
# OOo UNO environment:
: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/fundamentalrc}