]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.h
Change the meaning of the $$s placeholder to <lyx support dir>.
[lyx.git] / src / support / filetools.h
index f7b80c6c18fcc79b13cfa4de1e5c22368de8dbd2..1f3fe1fd59f9c8b565fb1c394bd22bff6b30c50f 100644 (file)
@@ -104,19 +104,42 @@ std::string const
 i18nLibFileSearch(std::string const & dir, std::string const & name,
                  std::string const & ext = std::string());
 
-/** Takes a command such as "sh $$s/convertDefault.sh file.in file.out"
- *  and replaces "$$s/" with the path to the "most important" of LyX's
- *  script directories 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 ;-)
+/** Takes a command such as "sh $$s/scripts/convertDefault.sh file.in file.out"
+ *  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 ;-)
  */
 std::string const LibScriptSearch(std::string const & command);
 
 ///
 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);
@@ -140,7 +163,10 @@ ChangeExtension(std::string const & oldname, std::string const & extension);
 /// Return the extension of the file (not including the .)
 std::string const GetExtension(std::string const & name);
 
-/// Guess the file format name (as in Format::name()) from contents
+/** 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