namespace support {
/// remove directory and all contents, returns true on success
-bool destroyDir(std::string const & tmpdir);
+bool destroyDir(FileName const & tmpdir);
/// Creates the per buffer temporary directory
std::string const createBufferTmpDir();
*/
FileName const createLyXTmpDir(FileName const & deflt);
+#if 0
+// FIXME unused. Should this be deleted or resurrected?
/** 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.
FileName const fileOpenSearch(std::string const & path,
std::string const & name,
std::string const & ext = std::string());
+#endif
+
+/// How to search files
+enum search_mode {
+ // The file must exist (return an empty file name otherwise)
+ standard_mode,
+ /// Only do file name expansion, return the complete name even if
+ /// the file does not exist
+ allow_unreadable
+};
/** Returns the real name of file name in directory path, with optional
extension ext.
*/
FileName const fileSearch(std::string const & path,
std::string const & name,
- std::string const & ext = std::string());
+ std::string const & ext = std::string(),
+ search_mode mode = standard_mode);
/// Returns a vector of all files in directory dir having extension ext.
-std::vector<std::string> const dirList(std::string const & dir,
+std::vector<std::string> const dirList(FileName const & dir,
std::string const & ext = std::string());
/** Is directory read only?
/// Remove the extension from \p name
std::string const removeExtension(std::string const & name);
+/** 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);
+
/// Return the extension of the file (not including the .)
std::string const getExtension(std::string const & name);
bool resolve = false);
/// Uses kpsewhich to find tex files
-std::string const findtexfile(std::string const & fil,
+FileName const findtexfile(std::string const & fil,
std::string const & format);
/// remove the autosave-file and give a Message if it can't be done