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
|
|
|
*
|
|
|
|
* 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
|
|
|
|
};
|
|
|
|
|
|
|
|
// do some work just once
|
|
|
|
void init(int * argc, char ** argv[]);
|
|
|
|
// returns path of LyX binary
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string binpath();
|
2003-06-30 23:56:22 +00:00
|
|
|
// returns name of LyX binary
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string binname();
|
2003-07-26 18:25:29 +00:00
|
|
|
//
|
2003-10-06 15:43:21 +00:00
|
|
|
void setTmpDir(std::string const & p);
|
2003-06-30 23:56:22 +00:00
|
|
|
//
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string getTmpDir();
|
2003-06-30 23:56:22 +00:00
|
|
|
//
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string current_root();
|
2003-06-30 23:56:22 +00:00
|
|
|
//
|
|
|
|
shell_type shell();
|
|
|
|
// DBCS aware!
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string::size_type common_path(std::string const & p1, std::string const & p2);
|
2003-06-30 23:56:22 +00:00
|
|
|
// no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string slashify_path(std::string const & p);
|
2003-06-30 23:56:22 +00:00
|
|
|
// converts a host OS path to unix style
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string external_path(std::string const & p);
|
2003-06-30 23:56:22 +00:00
|
|
|
// converts a unix path to host OS style
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string internal_path(std::string const & p);
|
2003-06-30 23:56:22 +00:00
|
|
|
// is path absolute?
|
2003-10-06 15:43:21 +00:00
|
|
|
bool is_absolute_path(std::string const & p);
|
2003-06-30 23:56:22 +00:00
|
|
|
// returns a string suitable to be passed to popen when
|
|
|
|
// same for popen().
|
2003-02-10 10:22:05 +00:00
|
|
|
char const * popen_read_mode();
|
2003-06-30 23:56:22 +00:00
|
|
|
//
|
2003-10-06 15:43:21 +00:00
|
|
|
void warn(std::string const & mesg);
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
|
|
} // namespace os
|
|
|
|
} // namespace support
|
|
|
|
} // namespace lyx
|
2001-05-17 15:11:01 +00:00
|
|
|
|
|
|
|
#endif
|