diff --git a/development/MacOSX/lyxeditor b/development/MacOSX/lyxeditor index 7431b3b991..ad8c407e01 100755 --- a/development/MacOSX/lyxeditor +++ b/development/MacOSX/lyxeditor @@ -82,9 +82,7 @@ test -z "${LYXPIPE}" && { } if [ -n "$LYXPIPE" -a -p "$LYXPIPE".in ]; then - file=$(echo "$1" | sed 's|^/private||') - - MAC_LYXPIPE_CONTENTS="LYXCMD:macdvix:server-goto-file-row:$file $2" + MAC_LYXPIPE_CONTENTS="LYXCMD:macdvix:server-goto-file-row:$1 $2" # echo "$MAC_LYXPIPE_CONTENTS" echo "$MAC_LYXPIPE_CONTENTS" > "${LYXPIPE}".in || { echo "Cannot write to lyxpipe." ; exit 2 ; } while read line ; do diff --git a/src/BufferList.cpp b/src/BufferList.cpp index 5e83c7b63e..f5b106d329 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -331,11 +331,12 @@ Buffer * BufferList::getBuffer(support::FileName const & fname, bool internal) c } -Buffer * BufferList::getBufferFromTmp(string const & s) +Buffer * BufferList::getBufferFromTmp(string const & s, bool realpath) { BufferStorage::iterator it = bstore.begin(); BufferStorage::iterator end = bstore.end(); for (; it < end; ++it) { + string const temppath = realpath ? FileName((*it)->temppath()).realPath() : (*it)->temppath(); if (prefixIs(s, (*it)->temppath())) { // check whether the filename matches the master string const master_name = (*it)->latexName(); diff --git a/src/BufferList.h b/src/BufferList.h index ca55abe8c9..8ccebf0ded 100644 --- a/src/BufferList.h +++ b/src/BufferList.h @@ -100,8 +100,9 @@ public: /// \return a pointer to the buffer with the given number Buffer * getBuffer(unsigned int); - /// \return a pointer to the buffer whose temppath matches the given path - Buffer * getBufferFromTmp(std::string const & path); + /// \return a pointer to the buffer whose temppath matches the given \p path + /// If optional \p realpath is \c true the lookup is done with real path names + Buffer * getBufferFromTmp(std::string const & path, bool realpath = false); /** returns a pointer to the buffer that follows argument in * buffer list. The buffer following the last in list is the diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 8d73c027b0..9ad0834b6a 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3493,7 +3493,7 @@ bool GuiView::goToFileRow(string const & argument) int row; size_t i = argument.find_last_of(' '); if (i != string::npos) { - file_name = os::internal_path(trim(argument.substr(0, i))); + file_name = os::internal_path(FileName(trim(argument.substr(0, i))).realPath()); istringstream is(argument.substr(i + 1)); is >> row; if (is.fail()) @@ -3504,20 +3504,14 @@ bool GuiView::goToFileRow(string const & argument) return false; } Buffer * buf = 0; - string const abstmp = package().temp_dir().absFileName(); string const realtmp = package().temp_dir().realPath(); // We have to use os::path_prefix_is() here, instead of // simply prefixIs(), because the file name comes from // an external application and may need case adjustment. - if (os::path_prefix_is(file_name, abstmp, os::CASE_ADJUSTED) - || os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) { - // Needed by inverse dvi search. If it is a file - // in tmpdir, call the apropriated function. - // If tmpdir is a symlink, we may have the real - // path passed back, so we correct for that. - if (!prefixIs(file_name, abstmp)) - file_name = subst(file_name, realtmp, abstmp); - buf = theBufferList().getBufferFromTmp(file_name); + if (os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) { + buf = theBufferList().getBufferFromTmp(file_name, true); + LYXERR(Debug::FILES, "goToFileRow: buffer lookup for " << file_name + << (buf ? " success" : " failed")); } else { // Must replace extension of the file to be .lyx // and get full path