]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.h
isome more FileName shuffling
[lyx.git] / src / support / filetools.h
index 7de0b67a5642385425e5b3a1ab4ed9cefca30eed..cc9ff79bfde4ae86e9edc5bc278463e96d2a1398 100644 (file)
@@ -13,7 +13,7 @@
 #define LYX_FILETOOL_H
 
 #include "support/docstring.h"
-#include "support/filename.h"
+#include "support/FileName.h"
 
 #include <vector>
 #include <utility>
@@ -29,7 +29,7 @@ bool destroyDir(FileName const & tmpdir);
 std::string const createBufferTmpDir();
 
 /// Creates directory. Returns true on success
-bool createDirectory(std::string const & name, int permissions);
+bool createDirectory(FileName const & name, int permissions);
 
 /** Creates the global LyX temp dir.
   \p deflt can be an existing directory name. In this case a new directory
@@ -76,24 +76,15 @@ FileName const fileSearch(std::string const & path,
 std::vector<FileName> const dirList(FileName const & dir,
                                       std::string const & ext = std::string());
 
-/** Is directory read only?
-  returns
-    true: dir writeable
-    false: not writeable
-*/
-bool isDirWriteable(FileName const & path);
-
-/** Is a file readable ?
-  Returns true if the file `path' is readable.
- */
-bool isFileReadable(FileName const & path);
-
 ///
 bool isLyXFilename(std::string const & filename);
 
 ///
 bool isSGMLFilename(std::string const & filename);
 
+///
+bool isValidLaTeXFilename(std::string const & filename);
+
 /** Returns the path of a library data file.
     Search the file name.ext in the subdirectory dir of
       -# user_lyxdir
@@ -224,7 +215,7 @@ std::string const unzippedFileName(std::string const & zipped_file);
   Will overwrite an already existing unzipped file without warning.
  */
 FileName const unzipFile(FileName const & zipped_file,
-                         std::string const & unzipped_file = std::string());
+                        std::string const & unzipped_file = std::string());
 
 /// Returns true is path is absolute
 bool absolutePath(std::string const & path);
@@ -252,8 +243,8 @@ makeDisplayPath(std::string const & path, unsigned int threshold = 1000);
   different, then the absolute path will be used as relative path
   WARNING: the absolute path and base path must really be absolute paths!!!
   */
-std::string const
-makeRelPath(std::string const & abspath, std::string const & basepath);
+docstring const
+makeRelPath(docstring const & abspath, docstring const & basepath);
 
 /// Strip filename from path name
 std::string const onlyPath(std::string const & fname);
@@ -276,14 +267,19 @@ std::string const getFileContents(FileName const & fname);
 */
 std::string const replaceEnvironmentPath(std::string const & path);
 
-/* 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 */
-bool readLink(std::string const & file,
-             std::string & link,
-             bool resolve = false);
+/** 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);
 
-/// Uses kpsewhich to find tex files
+/**
+ * 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.
+ */
 FileName const findtexfile(std::string const & fil,
                              std::string const & format);
 
@@ -309,4 +305,14 @@ cmd_ret const runCommand(std::string const & cmd);
 } // namespace support
 } // namespace lyx
 
+/// The following functions are implemented in minizip/zipunzip.cpp, and are not in
+/// the lyx::support namespace
+
+/// zip several files to a zipfile. In-zip filenames are also specified
+bool zipFiles(std::string const & zipfile, std::vector<std::pair<std::string, std::string> > const & files);
+
+/// Unzip a zip file to a directory
+bool unzipToDir(std::string const & zipfile, std::string const & path);
+
+
 #endif