lyx_mirror/src/support/environment.h
Georg Baum 77b9dbd557 Fix several filename and environment variable encoding problems
* src/LaTeX.C
	(LaTeX::deplog): Assume that filenames in log files are stored in
	the file system encoding

	* src/frontends/qt4/qt_helpers.[Ch]
	(internal_path): delete

	* src/frontends/qt4/QGraphics.C: Adjust to change above

	* src/frontends/qt4/QPrefsDialog.C: ditto

	* src/frontends/qt4/QExternal.C: ditto

	* src/frontends/qt4/QInclude.C: ditto

	* src/support/os.h: Document the encoding of filename arguments

	* src/support/os_win32.h: ditto

	* src/support/filetools.C
	(findtexfile): Convert filename from file system encoding

	* src/support/os_win32.C: Convert filenames from utf8 to file system
	encoding and vice versa where needed

	* src/support/os_cygwin.C: ditto

	* src/support/getcwd.C
	(getcwd): Use internal_path() with correct encoding

	* src/support/docstring.[Ch]
	(from_filesystem8bit): new conversion function

	* src/support/environment.C
	(getEnv): convert environment variable from local 8bit encoding to utf8
	(setEnv): convert environment variable from utf8 to local 8bit encoding

	* src/support/environment.h: document encoding of function arguments


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16753 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-18 20:47:27 +00:00

61 lines
2.0 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// -*- C++ -*-
/**
* \file environment.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_ENVIRONMENT_H
#define LYX_ENVIRONMENT_H
#include <string>
#include <vector>
namespace lyx {
namespace support {
/// @returns the contents of the environment variable @c name encoded in utf8.
std::string const getEnv(std::string const & envname);
/** @returns the contents of the environment variable @c name,
* split into path elements using the OS-dependent separator token
* and encoded in utf8.
* Each element is then passed through os::internal_path() to
* guarantee that it is in the form of a unix-style path.
* If the environment variable is not set, then the function returns
* an empty vector.
 */
std::vector<std::string> const getEnvPath(std::string const & name);
/** Set the contents of the environment variable @c name to @c value.
* \p value is encoded in utf8.
* @returns true if the variable was set successfully.
*/
bool setEnv(std::string const & name, std::string const & value);
/** Set the contents of the environment variable @c name
* using the paths stored in the @c env vector (encoded in utf8).
* Each element is passed through os::external_path().
* Multiple elements are concatenated into a single string using
* os::path_separator().
*/
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 (encoded in utf8).
* @prefix the list of paths in OS-native syntax (encoded in utf8).
* 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);
} // namespace support
} // namespace lyx
#endif // LYX_ENVIRONMENT_H