4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Ruurd A. Reitsma
9 * Full author contact details are available in file CREDITS.
11 * wrap OS-specific stuff
17 #include "support/docstring.h"
27 UNIX, // Do we have to distinguish sh and csh?
31 /// Do some work just once.
32 void init(int argc, char * argv[]);
34 /// Returns the name of the NULL device (/dev/null, null).
35 std::string const & nulldev();
37 /// Returns "/" on *nix, "C:/", etc on Windows.
38 std::string current_root();
43 /// Name of the python interpreter
44 std::string const python();
46 /// Extract the path common to both @c p1 and @c p2. DBCS aware!
47 std::string::size_type common_path(std::string const & p1, std::string const & p2);
49 /// Converts a unix style path to host OS style.
50 std::string external_path(std::string const & p);
52 /// Converts a host OS style path to unix style.
53 std::string internal_path(std::string const & p);
55 /// Converts a host OS style path to unix style.
56 docstring internal_path(docstring const & p);
58 /// Converts a unix style path list to host OS style.
59 std::string external_path_list(std::string const & p);
61 /// Converts a host OS style path list to unix style.
62 std::string internal_path_list(std::string const & p);
65 * Converts a unix style path into a form suitable for inclusion in a LaTeX
67 * Caution: This function handles only the OS specific part of that task.
68 * Never use it directly, use lyx::support::latex_path instead.
70 std::string latex_path(std::string const & p);
72 /// Is the path absolute?
73 bool is_absolute_path(std::string const & p);
75 /** Returns a string suitable to be passed to popen when
78 char const * popen_read_mode();
80 /** The character used to separate paths returned by the
81 * PATH environment variable.
83 char path_separator();
85 /** If @c use_windows_paths is true, LyX will output Windows-style paths to
86 * latex files rather than posix ones. Obviously, this option is used only
89 void windows_style_tex_paths(bool use_windows_paths);
96 /** Check whether or not a file can be opened by a default viewer or editor.
97 * \param extension (without leading .)
98 * \param mode can be opened in VIEW or EDIT mode
99 * \returns whether or not the format can be opened according to \p mode
101 bool canAutoOpenFile(std::string const & ext, auto_open_mode const mode = VIEW);
103 /** View or edit a file with the default viewer or editor.
104 * \param filename file to open
105 * \param mode open in VIEW or EDIT mode
106 * \returns whether or not the file is viewed (or edited) successfully.
108 bool autoOpenFile(std::string const & filename, auto_open_mode const mode = VIEW);
110 /** General font utilities.
111 * FIXME: only MAC and WIN32 for now but it would be nice to convince
112 * fontconfig to do the same for linux.
115 /// Add fonts to the font subsystem, must be called before Application
117 void addFontResources();
119 /// Restore original font resources, must be called after Application
121 void restoreFontResources();
124 } // namespace support