2003-06-18 09:56:10 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file os.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Ruurd A. Reitsma
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-10-08 11:31:51 +00:00
|
|
|
*
|
2004-12-14 16:38:22 +00:00
|
|
|
* wrap OS-specific stuff
|
2003-06-18 09:56:10 +00:00
|
|
|
*/
|
2001-05-17 15:11:01 +00:00
|
|
|
|
|
|
|
#ifndef OS_H
|
|
|
|
#define OS_H
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
#include <string>
|
|
|
|
|
2001-05-17 15:11:01 +00:00
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace support {
|
2003-02-10 10:22:05 +00:00
|
|
|
namespace os {
|
2001-05-17 15:11:01 +00:00
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
enum shell_type {
|
|
|
|
UNIX, // Do we have to distinguish sh and csh?
|
|
|
|
CMD_EXE
|
|
|
|
};
|
|
|
|
|
2005-01-13 10:10:16 +00:00
|
|
|
/// Do some work just once.
|
2004-12-14 16:20:07 +00:00
|
|
|
void init(int argc, char * argv[]);
|
2005-01-10 19:17:43 +00:00
|
|
|
|
2005-01-13 10:10:16 +00:00
|
|
|
/// Returns the name of the NULL device (/dev/null, null).
|
2004-12-15 19:35:43 +00:00
|
|
|
std::string const & nulldev();
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/// Returns "/" on *nix, "C:/", etc on Windows.
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string current_root();
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
///
|
2003-06-30 23:56:22 +00:00
|
|
|
shell_type shell();
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/// Extract the path common to both @c p1 and @c p2. DBCS aware!
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string::size_type common_path(std::string const & p1, std::string const & p2);
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/// Converts a unix style path to host OS style.
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string external_path(std::string const & p);
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/// Converts a host OS style path to unix style.
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string internal_path(std::string const & p);
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/// Is the path absolute?
|
2003-10-06 15:43:21 +00:00
|
|
|
bool is_absolute_path(std::string const & p);
|
2005-01-13 10:10:16 +00:00
|
|
|
|
|
|
|
/** Returns a string suitable to be passed to popen when
|
|
|
|
* reading a file.
|
|
|
|
*/
|
|
|
|
char const * popen_read_mode();
|
|
|
|
|
|
|
|
/** The character used to separate paths returned by the
|
|
|
|
* PATH environment variable.
|
|
|
|
*/
|
|
|
|
char path_separator();
|
2003-06-30 23:56:22 +00:00
|
|
|
|
2005-01-14 15:53:30 +00:00
|
|
|
/** If @c use_cygwin_paths is true, LyX will output cygwin style paths
|
|
|
|
* rather than native Win32 ones. Obviously, this option is used only
|
|
|
|
* under Cygwin.
|
|
|
|
*/
|
|
|
|
void cygwin_path_fix(bool use_cygwin_paths);
|
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
} // namespace os
|
|
|
|
} // namespace support
|
|
|
|
} // namespace lyx
|
2001-05-17 15:11:01 +00:00
|
|
|
|
|
|
|
#endif
|