/// remove directory and all contents, returns 0 on success
int destroyDir(std::string const & tmpdir);
-///
-std::string const CreateBufferTmpDir(std::string const & pathfor = std::string());
+/// Creates the per buffer temporary directory
+std::string const createBufferTmpDir();
/// Creates directory. Returns true on success
bool createDirectory(std::string const & name, int permissions);
-///
-std::string const CreateLyXTmpDir(std::string const & deflt);
+/** 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.
+ */
+std::string const createLyXTmpDir(std::string const & deflt);
/** Find file by searching several directories.
Uses a string of paths separated by ";"s to find a file to open.
///
std::string const GetEnv(std::string const & envname);
-/// A helper function.
-std::string const GetEnvPath(std::string const & name);
+/** Return the contents of the environment variable \c name,
+ * split using the OS-dependent token separating elements.
+ * Each element is then passed through os::internal_path to
+ * guarantee that it is in the form of a unix-stype path.
+ * If the environment variable is not set, then returns an empty vector.
+ */
+std::vector<std::string> const getEnvPath(std::string const & name);
+
+/** Set the contents of the environment variable \c name
+ * using the paths stored in the \c env vector.
+ * Each element is passed through os::external_path.
+ */
+void setEnvPath(std::string const & name, std::vector<std::string> const & env);
+
+/** Prepend a list of paths to that returned by the environment variable.
+ * Identical paths occurring later in the list are removed.
+ * @param name the name of the environment variable.
+ * @prefix the list of paths in OS-native syntax.
+ * Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
+ * "C:\foo\bar;C:\windows" on Windows.
+ */
+void prependEnvPath(std::string const & name, std::string const & prefix);
+
+/// Set an environment variable using a string of the form "name=FOO".
+bool putEnv(std::string const & envstr);
/// Substitutes active latex characters with underscores in filename
std::string const MakeLatexName(std::string const & file);
/// Return the extension of the file (not including the .)
std::string const GetExtension(std::string const & name);
-/// Return the type of the file as an extension from contents
-std::string const getExtFromContents(std::string const & name);
+/** Guess the file format name (as in Format::name()) from contents.
+ Normally you don't want to use this directly, but rather
+ Formats::getFormatFromFile().
+ */
+std::string const getFormatFromContents(std::string const & name);
/// check for zipped file
bool zippedFile(std::string const & name);
-/// \return the name that LyX will give to the unzipped file.
+/** \return the name that LyX will give to the unzipped file \p zipped_file
+ if the second argument of unzipFile() is empty.
+ */
std::string const unzippedFileName(std::string const & zipped_file);
-/// unzip a file
-std::string const unzipFile(std::string const & zipped_file);
+/** 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.
+ */
+std::string const unzipFile(std::string const & zipped_file,
+ std::string const & unzipped_file = std::string());
/// Returns true is path is absolute
bool AbsolutePath(std::string const & path);