+2002-07-17 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * lyx_main.C (init): make sure to read symlinks as absolute paths
+
2002-07-17 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.h:
2002-07-17 John Levon <moz@compsoc.man.ac.uk>
* lyxfunc.h:
if (file.isLink()) {
lyxerr[Debug::INIT] << "binary is a link" << endl;
string link;
if (file.isLink()) {
lyxerr[Debug::INIT] << "binary is a link" << endl;
string link;
- if (LyXReadLink(fullbinname, link)) {
+ if (LyXReadLink(fullbinname, link, true)) {
// Path of binary/../share/name of binary/
searchpath += NormalizePath(AddPath(binpath,
"../share/")
// Path of binary/../share/name of binary/
searchpath += NormalizePath(AddPath(binpath,
"../share/")
lyxerr << " directory " << fullbinpath
<< " is a link" << endl;
string link;
lyxerr << " directory " << fullbinpath
<< " is a link" << endl;
string link;
- if (LyXReadLink(fullbinpath, link)) {
+ if (LyXReadLink(fullbinpath, link, true)) {
fullbinpath = link;
binpath = MakeAbsPath(OnlyPath(fullbinpath));
}
fullbinpath = link;
binpath = MakeAbsPath(OnlyPath(fullbinpath));
}
+2002-07-17 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * filetools.C (LyXReadLink): add bool 'resolve' to return link
+ contents as an absolute path
+
2002-07-15 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* filetools.C (IsLyXFilename):
2002-07-15 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* filetools.C (IsLyXFilename):
-bool LyXReadLink(string const & File, string & Link)
+bool LyXReadLink(string const & file, string & link, bool resolve)
// Should be PATH_MAX but that needs autconf support
// Should be PATH_MAX but that needs autconf support
- int const nRead = ::readlink(File.c_str(),
- LinkBuffer, sizeof(LinkBuffer) - 1);
+ int const nRead = ::readlink(file.c_str(),
+ linkbuffer, sizeof(linkbuffer) - 1);
if (nRead <= 0)
return false;
if (nRead <= 0)
return false;
- LinkBuffer[nRead] = '\0'; // terminator
- Link = LinkBuffer;
+ linkbuffer[nRead] = '\0'; // terminator
+ if (resolve)
+ link = MakeAbsPath(linkbuffer, OnlyPath(file));
+ else
+ link = linkbuffer;
*/
string const ReplaceEnvironmentPath(string const & path);
*/
string const ReplaceEnvironmentPath(string const & path);
-/* Set Link to the path file points to as a symbolic link.
+/* Set \c link to the path \c file points to as a symbolic link.
+ If \c resolve is true, then \c link is an absolute path
Returns true if successful */
Returns true if successful */
-bool LyXReadLink(string const & file, string & Link);
+bool LyXReadLink(string const & file, string & link, bool resolve = false);
/// Uses kpsewhich to find tex files
string const findtexfile(string const & fil, string const & format);
/// Uses kpsewhich to find tex files
string const findtexfile(string const & fil, string const & format);