On Mon, May 18, 2015 at 10:09:42AM +0200, Stephan Witt wrote: > Am 18.05.2015 um 09:17 schrieb Enrico Forestieri <for...@lyx.org>: > > > On Sun, May 17, 2015 at 11:54:41PM -0700, Pavel Sanda wrote: > >> Scott Kostyshak wrote: > >>> When I am working on the documentation, any save now adds the following: > >>> > >>> +\origin /home/scott/lyxbuilds/master/repo/lib/templates/ > >> > >> Do we really have to ship author/login used in the machine? > >> I thought we have big fight already that we do not want to put > >> such kind of things without explicit permission on the user side. > > > > There will not be any author/login used in the machine. When installing, > > that line will become > > \origin /usr/share/lyx/templates/ > > How? Perhaps this is true for Linux. For Windows I don't know. > The installation on a Mac doesn't copy LyX files to system directories. > It puts all stuff into one application directory. This is either local > inside my home directory or perhaps some temporary directory.
Stephan, please can you check whether the attached patch works on Mac? For testing it, as an example, first save lib/examples/thesis/thesis.lyx in the current format (this is important) and then install LyX as you usually do with autotools. After that, move your application directory around and manually copy thesis.lyx somewhere else. I think you should do something like: $ cp /path/to/LyXappdir/examples/thesis/thesis.lyx /your/homedir/thesis.lyx Then try loading the copied file: $ /path/to/LyXappdir/bin/lyx /your/homedir/thesis.lyx If it works, all included files should be found. A quick way to check that is trying to typeset the document. It works if you don't get errors. -- Enrico
diff --git a/lib/Makefile.am b/lib/Makefile.am index e5d4557..c79596f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2308,11 +2308,52 @@ CLEANFILES += lyx@program_suffix@.desktop lyx.desktop-temp \ endif dist_noinst_DATA += lyx.desktop.in images/lyx.svg images/lyx.png +exampleandtemplate_files = \ + $(dist_caexamples_DATA) \ + $(dist_csexamples_DATA) \ + $(dist_daexamples_DATA) \ + $(dist_deexamples_DATA) \ + $(dist_elexamples_DATA) \ + $(dist_esexamples_DATA) \ + $(dist_euexamples_DATA) \ + $(dist_faexamples_DATA) \ + $(dist_frexamples_DATA) \ + $(dist_glexamples_DATA) \ + $(dist_heexamples_DATA) \ + $(dist_huexamples_DATA) \ + $(dist_idexamples_DATA) \ + $(dist_itexamples_DATA) \ + $(dist_jaexamples_DATA) \ + $(dist_koexamples_DATA) \ + $(dist_nlexamples_DATA) \ + $(dist_plexamples_DATA) \ + $(dist_ptexamples_DATA) \ + $(dist_roexamples_DATA) \ + $(dist_ruexamples_DATA) \ + $(dist_slexamples_DATA) \ + $(dist_skexamples_DATA) \ + $(dist_srexamples_DATA) \ + $(dist_svexamples_DATA) \ + $(dist_springerexamples_DATA) \ + $(dist_thesisexamples_DATA) \ + $(dist_ukexamples_DATA) \ + $(dist_examples_DATA) \ + $(dist_templates_DATA) + install-data-hook: $(CHMOD) 755 $(DESTDIR)$(pkgdatadir)/configure.py for i in $(DESTDIR)$(scriptsdir)/*.py $(DESTDIR)$(scriptsdir)/listerrors ; do \ $(CHMOD) 755 $$i; \ done + for i in $(exampleandtemplate_files); do \ + if $(EGREP) -q "^\\\\origin " "$(DESTDIR)$(pkgdatadir)/$$i"; then \ + origin=`dirname "/systemlyxdir/$$i"`/; \ + sed -e "s|^\\\\origin .*|\\\\origin $$origin|" \ + "$(DESTDIR)$(pkgdatadir)/$$i" > "$(DESTDIR)$(pkgdatadir)/$$i.tmp"; \ + mv -f "$(DESTDIR)$(pkgdatadir)/$$i.tmp" "$(DESTDIR)$(pkgdatadir)/$$i"; \ + chmod 644 "$(DESTDIR)$(pkgdatadir)/$$i"; \ + fi; \ + done alltests: check alltests-recursive diff --git a/lib/doc/Makefile.am b/lib/doc/Makefile.am index 38c545b..e9b9f64 100644 --- a/lib/doc/Makefile.am +++ b/lib/doc/Makefile.am @@ -322,8 +322,8 @@ doc_files = \ install-data-hook: for i in $(doc_files); \ do \ - if $(EGREP) -q "LYX_DIR_VER|LYX_USERDIR_VER|^\\origin " "$(DESTDIR)$(docdir)/$$i"; then \ - origin=`dirname "$(docdir)/$$i"`/; \ + if $(EGREP) -q "LYX_DIR_VER|LYX_USERDIR_VER|^\\\\origin " "$(DESTDIR)$(docdir)/$$i"; then \ + origin=`dirname "/systemlyxdir/doc/$$i"`/; \ sed -e "s/LYX_DIR_VER/$(LYX_DIR_VER)/g" \ -e "s/LYX_USERDIR_VER/$(LYX_USERDIR_VER)/g" \ -e "s|^\\\\origin .*|\\\\origin $$origin|" \ diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 34f1a50..0f466b0 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -54,6 +54,7 @@ #include "support/gettext.h" #include "support/Messages.h" #include "support/mutex.h" +#include "support/Package.h" #include "support/Translator.h" #include "support/lstrings.h" @@ -660,6 +661,11 @@ string BufferParams::readToken(Lexer & lex, string const & token, } else if (token == "\\origin") { lex.eatLine(); origin = lex.getString(); + string const sysdirprefix = "/systemlyxdir/"; + if (prefixIs(origin, sysdirprefix)) { + origin.replace(0, sysdirprefix.length() - 1, + package().system_support().absFileName()); + } } else if (token == "\\begin_preamble") { readPreamble(lex); } else if (token == "\\begin_local_layout") {