]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.h
small cleanup, doxygen, formatting changes
[lyx.git] / src / support / filetools.h
index 289e702e801870daa88a303809a1347345042bef..65505a9b2ecd19706dd7f27a17d74ff963290afe 100644 (file)
@@ -15,6 +15,8 @@
 #include <fcntl.h>
 #include <cerrno>
 
+#include <vector>
+
 #include "debug.h"
 #include "LString.h"
 #include "support/lstrings.h"
@@ -53,6 +55,10 @@ string const FileOpenSearch (string const & path, string const & name,
 string const FileSearch(string const & path, string const & name, 
                  string const & ext = string());
 
+/// Returns a vector of all files in directory dir having extension ext.
+std::vector<string> const DirList(string const & dir,
+                                 string const & ext = string());
+
 /** Is directory read only?
   returns 
     1: dir writeable
@@ -77,6 +83,9 @@ int IsFileWriteable (string const & path);
 ///
 bool IsLyXFilename(string const & filename);
 
+///
+bool IsSGMLFilename(string const & filename);
+
 /** Returns the path of a library data file.
   Search the file name.ext in the subdirectory dir of
   \begin{enumerate}
@@ -115,14 +124,6 @@ string const MakeLatexName(string const & file);
 /// Put the name in quotes suitable for the current shell
 string const QuoteName(string const & file);
 
-/** Returns an unique name to be used as a temporary file. If given,
-  'mask' should the prefix to the temporary file, the rest of the
-  temporary filename will be made from the pid and three letters.
-  */
-string const
-TmpFileName(string const & dir = string(), 
-           string const & mask = "lyx_tmp");
-
 /// Is a filename/path absolute?
 bool AbsolutePath(string const & path);
 
@@ -139,19 +140,18 @@ string const AddPath(string const & path, string const & path2);
 string const
 ChangeExtension(string const & oldname, string const & extension);
 
+/// Return the extension of the file (not including the .)
+string const GetExtension(string const & name);
+
 /// Create absolute path. If impossible, don't do anything
 string const ExpandPath(string const & path);
 
-/// gets current working directory
-string const GetCWD();
-
-
 /** Convert relative path into absolute path based on a basepath.
   If relpath is absolute, just use that.
   If basepath doesn't exist use CWD.
   */
 string const MakeAbsPath(string const & RelPath = string(), 
-                  string const & BasePath = string());
+                        string const & BasePath = string());
 
 /** Creates a nice compact path for displaying. The parameter
   threshold, if given, specifies the maximal length of the path.
@@ -179,6 +179,9 @@ string const NormalizePath(string const & path);
 /// Strips path from filename
 string const OnlyFilename(string const & fname);
 
+/// Strips filename from path
+string const BasePath(string const & fname);
+
 /// Get the contents of a file as a huge string
 string const GetFileContents(string const & fname);
 
@@ -196,7 +199,10 @@ string const ReplaceEnvironmentPath(string const & path);
    Returns true if successful */
 bool LyXReadLink(string const & file, string & Link);
 
-/* Uses kpsewhich to find tex files */
+/// Uses kpsewhich to find tex files
 string const findtexfile(string const & fil, string const & format);
 
+/// remove the autosave-file and give a Message if it can't be done
+void removeAutosaveFile(string const & filename);
+
 #endif