2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 10:03:41 +00:00
|
|
|
/**
|
|
|
|
* \file filetools.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2003-06-18 09:56:10 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-06-18 09:56:10 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 10:03:41 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
#ifndef LYX_FILETOOL_H
|
|
|
|
#define LYX_FILETOOL_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2002-07-22 17:11:41 +00:00
|
|
|
#include <utility>
|
2003-10-06 15:43:21 +00:00
|
|
|
#include <string>
|
2018-02-08 10:31:23 +00:00
|
|
|
#include <set>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace support {
|
|
|
|
|
2007-12-17 16:04:46 +00:00
|
|
|
class FileName;
|
|
|
|
|
2018-02-08 10:31:23 +00:00
|
|
|
/// Record used temp file names
|
|
|
|
static std::set<std::string> tmp_names_;
|
|
|
|
|
|
|
|
/// Get a temporary file name.
|
|
|
|
/**
|
|
|
|
* The actual temp file (QTemporaryFile object) is immediately
|
|
|
|
* destroyed after the name has been generated, so a new file
|
|
|
|
* has to be created manually from the name.
|
|
|
|
* This is needed if the temp file has to be manually removed
|
|
|
|
* (e.g., when temp files are used as conversion target, and the initial
|
|
|
|
* file only serves as a placeholder), since QTemporaryFile objects
|
|
|
|
* cannot be manually removed at least on Windows (they are always
|
|
|
|
* kept open internally even after close()).
|
|
|
|
* In order to avoid race conditions due to duplicate names, we record
|
|
|
|
* all used temp file names.
|
|
|
|
* If you don't have to remove the temp file manually, use TempFile instead!
|
|
|
|
*/
|
2018-02-08 11:16:30 +00:00
|
|
|
FileName const tempFileName(std::string const &, bool const dir = false);
|
2018-02-08 10:31:23 +00:00
|
|
|
|
|
|
|
/// Remove and unregister a temporary file.
|
|
|
|
void removeTempFile(FileName const &);
|
|
|
|
|
2004-02-25 12:00:53 +00:00
|
|
|
/** Creates the global LyX temp dir.
|
|
|
|
\p deflt can be an existing directory name. In this case a new directory
|
|
|
|
inside \p deflt is created. If \p deflt does not exist yet, \p deflt is
|
|
|
|
created and used as the temporary directory.
|
|
|
|
\return the tmp dir name or string() if something went wrong.
|
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const createLyXTmpDir(FileName const & deflt);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-12-21 12:04:01 +00:00
|
|
|
#if 0
|
|
|
|
// FIXME unused. Should this be deleted or resurrected?
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Find file by searching several directories.
|
|
|
|
Uses a string of paths separated by ";"s to find a file to open.
|
|
|
|
Can't cope with pathnames with a ';' in them. Returns full path to file.
|
|
|
|
If path entry begins with $$LyX/, use system_lyxdir.
|
|
|
|
If path entry begins with $$User/, use user_lyxdir.
|
|
|
|
Example: "$$User/doc;$$LyX/doc".
|
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const fileOpenSearch(std::string const & path,
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const & name,
|
|
|
|
std::string const & ext = std::string());
|
2006-12-21 12:04:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/// How to search files
|
|
|
|
enum search_mode {
|
2008-01-26 20:25:25 +00:00
|
|
|
/// The file must exist (return an empty file name otherwise)
|
|
|
|
must_exist,
|
2006-12-21 12:04:01 +00:00
|
|
|
/// Only do file name expansion, return the complete name even if
|
|
|
|
/// the file does not exist
|
2014-10-18 13:19:47 +00:00
|
|
|
may_not_exist,
|
|
|
|
/// The (image) file may be present with hi-dpi resolution -
|
|
|
|
/// the lookup checks for a file named "image" + "@2x" + ".ext" first.
|
|
|
|
/// If found it will return e.g. "image@2x.png" instead of "image.png".
|
|
|
|
/// Otherwise it will work as must_exist.
|
|
|
|
check_hidpi
|
2006-12-21 12:04:01 +00:00
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Returns the real name of file name in directory path, with optional
|
|
|
|
extension ext.
|
|
|
|
The file is searched in the given path (unless it is an absolute
|
|
|
|
file name), first directly, and then with extension .ext (if given).
|
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const fileSearch(std::string const & path,
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const & name,
|
2006-12-21 12:04:01 +00:00
|
|
|
std::string const & ext = std::string(),
|
2008-01-26 20:25:25 +00:00
|
|
|
search_mode mode = must_exist);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2010-04-21 01:19:31 +00:00
|
|
|
bool isLyXFileName(std::string const & filename);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-11-13 15:43:36 +00:00
|
|
|
///
|
2010-04-21 01:19:31 +00:00
|
|
|
bool isSGMLFileName(std::string const & filename);
|
2000-11-13 15:43:36 +00:00
|
|
|
|
2010-09-27 02:39:22 +00:00
|
|
|
/// check for characters in filenames not allowed by LaTeX
|
2010-04-21 01:19:31 +00:00
|
|
|
bool isValidLaTeXFileName(std::string const & filename);
|
2007-06-26 16:55:42 +00:00
|
|
|
|
2010-09-27 02:39:22 +00:00
|
|
|
/** check for characters in filenames that might lead to
|
|
|
|
problems when manually compiling the LaTeX export of LyX
|
|
|
|
and opening the result with some older DVI-viewers
|
|
|
|
*/
|
|
|
|
bool isValidDVIFileName(std::string const & filename);
|
|
|
|
|
2014-06-11 21:04:39 +00:00
|
|
|
/// check whether the file has binary contents
|
|
|
|
bool isBinaryFile(FileName const & filename);
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Returns the path of a library data file.
|
2005-07-08 15:43:46 +00:00
|
|
|
Search the file name.ext in the subdirectory dir of
|
|
|
|
-# user_lyxdir
|
|
|
|
-# build_lyxdir (if not empty)
|
|
|
|
-# system_lyxdir
|
1999-09-27 18:44:28 +00:00
|
|
|
The third parameter `ext' is optional.
|
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const libFileSearch(std::string const & dir,
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const & name,
|
2014-10-18 13:19:47 +00:00
|
|
|
std::string const & ext = std::string(),
|
|
|
|
search_mode mode = must_exist);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-04-08 22:31:11 +00:00
|
|
|
/** Same as libFileSearch(), but tries first to find an
|
1999-09-27 18:44:28 +00:00
|
|
|
internationalized version of the file by prepending $LANG_ to the
|
2002-03-21 17:09:55 +00:00
|
|
|
name
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const
|
2006-04-08 22:31:11 +00:00
|
|
|
i18nLibFileSearch(std::string const & dir,
|
|
|
|
std::string const & name,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & ext = std::string());
|
1999-10-02 16:21:10 +00:00
|
|
|
|
2011-03-25 01:59:34 +00:00
|
|
|
/** Same as libFileSearch(), but tries first to find a preferred
|
|
|
|
version of the file by appending the icon set name to the dir
|
|
|
|
*/
|
|
|
|
FileName const
|
|
|
|
imageLibFileSearch(std::string & dir, std::string const & name,
|
2014-10-18 13:19:47 +00:00
|
|
|
std::string const & ext = std::string(),
|
|
|
|
search_mode mode = must_exist);
|
2011-03-25 01:59:34 +00:00
|
|
|
|
2006-09-11 16:07:49 +00:00
|
|
|
/// How to quote a filename
|
|
|
|
enum quote_style {
|
|
|
|
/** Quote for the (OS dependant) shell. This is needed for command
|
|
|
|
line arguments of subprocesses. */
|
|
|
|
quote_shell,
|
2014-11-19 21:47:36 +00:00
|
|
|
/** Quote a file name for the (OS dependant) shell. This is needed
|
|
|
|
for file names as command line arguments of subprocesses. */
|
|
|
|
quote_shell_filename,
|
2006-09-11 16:07:49 +00:00
|
|
|
/** Quote for python. Use this if you want to store a filename in a
|
|
|
|
python script. Example: \code
|
|
|
|
os << "infile = " << quoteName(filename) << '\\n';
|
|
|
|
\endcode This uses double quotes, so that you can also use this
|
|
|
|
to quote filenames as part of a string if the string is quoted
|
|
|
|
with single quotes. */
|
|
|
|
quote_python
|
|
|
|
};
|
|
|
|
|
2006-06-26 14:17:12 +00:00
|
|
|
/** Takes a command such as "python $$s/scripts/convertDefault.py file.in file.out"
|
2005-01-20 15:02:16 +00:00
|
|
|
* and replaces "$$s/" with the path to the LyX support directory containing
|
|
|
|
* this script. If the script is not found, "$$s/" is removed. Executing the
|
|
|
|
* command will still fail, but the error message will make some sort of
|
|
|
|
* sense ;-)
|
2003-06-01 20:49:48 +00:00
|
|
|
*/
|
2014-02-03 15:57:52 +00:00
|
|
|
std::string const commandPrep(std::string const & command);
|
2002-03-27 00:05:28 +00:00
|
|
|
|
2005-07-10 09:31:27 +00:00
|
|
|
enum latex_path_extension {
|
|
|
|
PROTECT_EXTENSION,
|
|
|
|
EXCLUDE_EXTENSION
|
|
|
|
};
|
|
|
|
|
|
|
|
enum latex_path_dots {
|
|
|
|
LEAVE_DOTS,
|
|
|
|
ESCAPE_DOTS
|
|
|
|
};
|
|
|
|
|
2005-04-18 17:43:11 +00:00
|
|
|
/** @param path a file path in internal_path format. Ie, directories
|
|
|
|
* are indicated by '/', not by '\'.
|
|
|
|
*
|
|
|
|
* Manipulates @c path into a form suitable for inclusion in a LaTeX
|
2005-04-26 11:12:20 +00:00
|
|
|
* document.
|
2005-04-18 17:43:11 +00:00
|
|
|
* If @c path contains LaTeX special characters, these are escaped.
|
2005-07-08 15:43:46 +00:00
|
|
|
* Eg, '~' -> '\\string~'
|
2005-04-18 17:43:11 +00:00
|
|
|
* If @c path contains spaces, then the returned path is enclosed in
|
|
|
|
* "-quotes. This last fix will lead to successful compiliation of the
|
|
|
|
* LaTeX file only if a sufficiently modern LaTeX compiler is used.
|
2005-07-10 09:31:27 +00:00
|
|
|
* If @c ext == EXCLUDE_EXTENSION the extension is left outside the quotes.
|
2005-07-08 15:43:46 +00:00
|
|
|
* This is needed for pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
|
|
|
|
* (format=pdflatex 2005.4.11) in combination with
|
|
|
|
* pdftex.def 2002/06/19 v0.03k graphics/color for pdftex:
|
|
|
|
* It does not recognize the file extension if it is inside the quotes.
|
2005-07-10 09:31:27 +00:00
|
|
|
* If @c dots == ESCAPE_DOTS dots in the filename are replaced by
|
|
|
|
* "\\lyxdot ". This is needed for the \\includegraphics command if the
|
|
|
|
* automatic format selection is used.
|
2005-04-18 17:43:11 +00:00
|
|
|
*/
|
2005-07-08 15:43:46 +00:00
|
|
|
std::string const latex_path(std::string const & path,
|
2005-07-10 09:31:27 +00:00
|
|
|
latex_path_extension extension = PROTECT_EXTENSION,
|
|
|
|
latex_path_dots dots = LEAVE_DOTS);
|
2005-04-18 17:43:11 +00:00
|
|
|
|
1999-12-03 13:51:01 +00:00
|
|
|
/// Substitutes active latex characters with underscores in filename
|
2007-11-28 18:07:09 +00:00
|
|
|
FileName const makeLatexName(FileName const & file);
|
1999-12-03 13:51:01 +00:00
|
|
|
|
2006-09-11 16:07:49 +00:00
|
|
|
/** Put the name in quotes suitable for the current shell or python,
|
|
|
|
depending on \p style. */
|
|
|
|
std::string const quoteName(std::string const & file, quote_style style = quote_shell);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Add a filename to a path. Any path from filename is stripped first.
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const addName(std::string const & path, std::string const & fname);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Append sub-directory(ies) to path in an intelligent way
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const addPath(std::string const & path, std::string const & path2);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Change extension of oldname to extension.
|
|
|
|
If oldname does not have an extension, it is appended.
|
|
|
|
If the extension is empty, any extension is removed from the name.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const
|
2006-04-08 22:31:11 +00:00
|
|
|
changeExtension(std::string const & oldname, std::string const & extension);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-04-01 10:49:58 +00:00
|
|
|
/// Remove the extension from \p name
|
|
|
|
std::string const removeExtension(std::string const & name);
|
|
|
|
|
2006-12-21 12:04:01 +00:00
|
|
|
/** Add the extension \p ext to \p name.
|
|
|
|
Use this instead of changeExtension if you know that \p name is without
|
|
|
|
extension, because changeExtension would wrongly interpret \p name if it
|
|
|
|
contains a dot.
|
|
|
|
*/
|
|
|
|
std::string const
|
|
|
|
addExtension(std::string const & name, std::string const & extension);
|
|
|
|
|
2000-08-30 03:40:51 +00:00
|
|
|
/// Return the extension of the file (not including the .)
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const getExtension(std::string const & name);
|
2000-08-30 03:40:51 +00:00
|
|
|
|
2004-02-25 12:00:53 +00:00
|
|
|
/** \return the name that LyX will give to the unzipped file \p zipped_file
|
|
|
|
if the second argument of unzipFile() is empty.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const unzippedFileName(std::string const & zipped_file);
|
2003-09-03 17:23:38 +00:00
|
|
|
|
2004-02-25 12:00:53 +00:00
|
|
|
/** Unzip \p zipped_file.
|
|
|
|
The unzipped file is named \p unzipped_file if \p unzipped_file is not
|
|
|
|
empty, and unzippedFileName(\p zipped_file) otherwise.
|
|
|
|
Will overwrite an already existing unzipped file without warning.
|
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
FileName const unzipFile(FileName const & zipped_file,
|
2007-05-28 22:27:45 +00:00
|
|
|
std::string const & unzipped_file = std::string());
|
2002-02-07 19:37:34 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** Convert relative path into absolute path based on a basepath.
|
|
|
|
If relpath is absolute, just use that.
|
|
|
|
If basepath doesn't exist use CWD.
|
|
|
|
*/
|
2006-12-27 10:56:11 +00:00
|
|
|
FileName const makeAbsPath(std::string const & RelPath = std::string(),
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const & BasePath = std::string());
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Creates a nice compact path for displaying. The parameter
|
|
|
|
threshold, if given, specifies the maximal length of the path.
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring const
|
2006-04-08 22:31:11 +00:00
|
|
|
makeDisplayPath(std::string const & path, unsigned int threshold = 1000);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Makes relative path out of absolute path.
|
|
|
|
If it is deeper than basepath,
|
|
|
|
it's easy. If basepath and abspath share something (they are all deeper
|
|
|
|
than some directory), it'll be rendered using ..'s. If they are completely
|
|
|
|
different, then the absolute path will be used as relative path
|
|
|
|
WARNING: the absolute path and base path must really be absolute paths!!!
|
|
|
|
*/
|
2007-03-27 07:24:16 +00:00
|
|
|
docstring const
|
|
|
|
makeRelPath(docstring const & abspath, docstring const & basepath);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Strip filename from path name
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const onlyPath(std::string const & fname);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Strips path from filename
|
2010-04-21 01:19:28 +00:00
|
|
|
std::string const onlyFileName(std::string const & fname);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Check and Replace Environmentvariables ${NAME} in Path.
|
2017-09-22 07:29:16 +00:00
|
|
|
Replaces all occurrences of these, if they are found in the
|
1999-09-27 18:44:28 +00:00
|
|
|
environment.
|
|
|
|
Variables are defined by Var := '${' [a-zA-Z_][a-zA-Z_0-9]* '}'
|
|
|
|
*/
|
2006-04-08 22:31:11 +00:00
|
|
|
std::string const replaceEnvironmentPath(std::string const & path);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2011-09-25 13:35:42 +00:00
|
|
|
/**
|
|
|
|
Return a string to be used as a prefix to a command for setting the
|
Fix bug #4812 (Layout in local directory lost on Save As, Copying)
The "save-as" part of the bug is fixed by extending the \textclass tag
such that, if a local layout file is used, its path relative to the
document directory is now stored together with the name. If a relative
path cannot be used, an absolute one is used but, in this case, the
document is not usable on a different platform.
The "copy" part is fixed by introducing a new \origin tag, which is
written when the file is saved. This tag stores the absolute path of
the document directory. If the document is manually copied to a
different location, the local layout file is retrivied by using
\origin (which is only updated on save).
This new tag may prove useful also for locating other files when the
document is manually moved to a different directory.
As in the original implementation the files needed for the layout
(for example, a latex class) had to be in the same directory as the
layout file, this directory has also to be added to TEXINPUTS.
2015-05-13 19:40:51 +00:00
|
|
|
environment of the TeX engine with respect to the paths \p path and \p lpath.
|
2011-09-25 13:35:42 +00:00
|
|
|
*/
|
Fix bug #4812 (Layout in local directory lost on Save As, Copying)
The "save-as" part of the bug is fixed by extending the \textclass tag
such that, if a local layout file is used, its path relative to the
document directory is now stored together with the name. If a relative
path cannot be used, an absolute one is used but, in this case, the
document is not usable on a different platform.
The "copy" part is fixed by introducing a new \origin tag, which is
written when the file is saved. This tag stores the absolute path of
the document directory. If the document is manually copied to a
different location, the local layout file is retrivied by using
\origin (which is only updated on save).
This new tag may prove useful also for locating other files when the
document is manually moved to a different directory.
As in the original implementation the files needed for the layout
(for example, a latex class) had to be in the same directory as the
layout file, this directory has also to be added to TEXINPUTS.
2015-05-13 19:40:51 +00:00
|
|
|
std::string latexEnvCmdPrefix(std::string const &path, std::string const & lpath);
|
2011-09-25 13:35:42 +00:00
|
|
|
|
Introduce the possibility of setting a prefix for the TEXINPUTS environment
variable. This is done in the preferences, much like as the PATH prefix.
A single '.' in the paths will get replaced with the current document dir
and also non-absolute paths will be prefixed with that dir.
The default semantics of TEXINPUTS apply, such that, for example, if a
path is terminated with a double slash, all subdirectories will be also
searched by both the TeX engine and ancillary programs such as dvi
previewers or dvips. As an example, if the prefix is set to ".:figs", the
TEXINPUTS variable will be set as ".:<docdir>:<docdir>/figs:$ORIGTEXINPUTS",
where <docdir> is the document directory.
The initial '.' is necessary to address the actual current dir (this will
be the temp dir at preview time), while if TEXINPUTS was initially unset,
such that $ORIGTEXINPUTS is empty, a colon (or semicolon on Windows) will
end the path list. This is very important, because we don't want to replace
the system directories but to complement them and, in order to do that, an
empty element has to be present in the list. Indeed, according to the
TEXINPUTS semantics, an empty element means the standard search path.
This works whether TEXINPUTS is originally set or not, because if the
original TEXINPUTS starts with a colon (meaning that the standard search
path is wanted there) we will have an empty element at that point,
otherwise the final colon will simply serve as a path separator.
Of course, on Windows a ';' has to be used as a path separator. LyX will
take care of transforming the platform path list into one understandable
by the TeX engine. For example, this will be the case for a Cygwin version
of LyX using a native Windows TeX engine or viceversa. I tested all of
this and it works for me.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38681 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-09 23:25:51 +00:00
|
|
|
/** Replace all references to a current directory (a lonely '.' or
|
|
|
|
the prefix "./") in \c pathlist with \c path. Also prefixes
|
|
|
|
all non-absolute paths with \c path.
|
|
|
|
*/
|
|
|
|
std::string const replaceCurdirPath(std::string const & path, std::string const & pathlist);
|
|
|
|
|
2007-04-06 13:09:54 +00:00
|
|
|
/** Set \c link to the path \c file points to as a symbolic link.
|
|
|
|
\return true if successful.
|
|
|
|
*/
|
|
|
|
bool readLink(FileName const & file, FileName & link);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-01-09 19:10:29 +00:00
|
|
|
/**
|
|
|
|
* Search a TeX file in all locations the latex compiler would search it,
|
|
|
|
* with the help of kpsewhich.
|
|
|
|
* The current working directory must be set correctly, so that relative
|
|
|
|
* names work.
|
|
|
|
* \param fil The filename to search
|
|
|
|
* \param format The file format as used by kpsewhich, e.g. "bib", "bst" etc.
|
|
|
|
*/
|
2006-12-01 20:09:08 +00:00
|
|
|
FileName const findtexfile(std::string const & fil,
|
2018-04-07 20:09:06 +00:00
|
|
|
std::string const & format,
|
|
|
|
bool const onlykpse = false);
|
1999-11-24 22:14:46 +00:00
|
|
|
|
2003-09-03 17:23:38 +00:00
|
|
|
/** \param file1, file2 the two files to be compared. Must have absolute paths.
|
|
|
|
* \returns 1 if \c file1 has a more recent timestamp than \c file2,
|
|
|
|
* 0 if their timestamps are the same,
|
|
|
|
* -1 if \c file2 has a more recent timestamp than \c file1.
|
|
|
|
* If one of the files does not exist, the return value indicates the file
|
|
|
|
* which does exist. Eg, if \c file1 exists but \c file2 does not, return 1.
|
2003-06-03 10:14:52 +00:00
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
int compare_timestamps(FileName const & file1, FileName const & file2);
|
2003-06-03 10:14:52 +00:00
|
|
|
|
2011-01-16 19:51:02 +00:00
|
|
|
/// \param lfuns: true if we're converting lfuns, false if prefs
|
|
|
|
bool prefs2prefs(FileName const & filename, FileName const & tempfile,
|
|
|
|
bool lfuns);
|
|
|
|
|
2014-12-29 22:46:25 +00:00
|
|
|
/// Does file \p file need to be updated by configure.py?
|
|
|
|
bool configFileNeedsUpdate(std::string const & file);
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::pair<int, std::string> cmd_ret;
|
2002-07-22 17:11:41 +00:00
|
|
|
|
2006-04-08 22:31:11 +00:00
|
|
|
cmd_ret const runCommand(std::string const & cmd);
|
2002-01-31 14:20:09 +00:00
|
|
|
|
2013-11-20 18:40:32 +00:00
|
|
|
int fileLock(const char * lock_file);
|
|
|
|
void fileUnlock(int fd, const char * lock_file);
|
2007-11-30 20:57:53 +00:00
|
|
|
|
2007-09-03 21:09:11 +00:00
|
|
|
} // namespace support
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-21 14:48:47 +00:00
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|