2003-06-18 09:56:10 +00:00
|
|
|
/**
|
|
|
|
* \file os_unix.C
|
|
|
|
* 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-06-18 09:56:10 +00:00
|
|
|
*
|
|
|
|
* Various OS specific functions
|
|
|
|
*/
|
2001-05-17 15:11:01 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2004-11-07 13:22:51 +00:00
|
|
|
#include "support/os.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace support {
|
2003-02-10 10:22:05 +00:00
|
|
|
namespace os {
|
|
|
|
|
2005-01-10 19:17:43 +00:00
|
|
|
void init(int, char *[])
|
|
|
|
{}
|
2001-05-17 15:11:01 +00:00
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
|
|
|
string current_root()
|
|
|
|
{
|
|
|
|
return "/";
|
2001-05-17 15:11:01 +00:00
|
|
|
}
|
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
|
|
|
string::size_type common_path(string const & p1, string const & p2)
|
|
|
|
{
|
|
|
|
string::size_type i = 0;
|
|
|
|
string::size_type p1_len = p1.length();
|
|
|
|
string::size_type p2_len = p2.length();
|
|
|
|
while (i < p1_len && i < p2_len && p1[i] == p2[i])
|
|
|
|
++i;
|
2001-05-17 15:11:01 +00:00
|
|
|
if ((i < p1_len && i < p2_len)
|
|
|
|
|| (i < p1_len && p1[i] != '/' && i == p2_len)
|
2003-02-10 10:22:05 +00:00
|
|
|
|| (i < p2_len && p2[i] != '/' && i == p1_len))
|
|
|
|
{
|
|
|
|
if (i)
|
|
|
|
--i; // here was the last match
|
|
|
|
while (i && p1[i] != '/')
|
|
|
|
--i;
|
2001-05-17 15:11:01 +00:00
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
|
|
|
string external_path(string const & p)
|
|
|
|
{
|
2001-05-17 15:11:01 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
|
|
|
string internal_path(string const & p)
|
|
|
|
{
|
2001-10-04 09:57:02 +00:00
|
|
|
return p;
|
|
|
|
}
|
2001-10-08 14:09:06 +00:00
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
2006-04-05 19:26:08 +00:00
|
|
|
string external_path_list(string const & p)
|
|
|
|
{
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string internal_path_list(string const & p)
|
|
|
|
{
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-24 12:48:37 +00:00
|
|
|
string latex_path(string const & p)
|
|
|
|
{
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
bool is_absolute_path(string const & p)
|
2001-10-08 14:09:06 +00:00
|
|
|
{
|
2003-02-10 10:22:05 +00:00
|
|
|
return !p.empty() && p[0] == '/';
|
2001-10-08 14:09:06 +00:00
|
|
|
}
|
2002-02-08 14:32:17 +00:00
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
|
|
|
char const * popen_read_mode()
|
2002-02-08 14:32:17 +00:00
|
|
|
{
|
|
|
|
return "r";
|
|
|
|
}
|
2002-09-23 16:03:11 +00:00
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
|
2004-12-15 19:35:43 +00:00
|
|
|
string const & nulldev()
|
|
|
|
{
|
2005-01-10 19:17:43 +00:00
|
|
|
static string const nulldev_ = "/dev/null";
|
2004-12-15 19:35:43 +00:00
|
|
|
return nulldev_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-10 10:22:05 +00:00
|
|
|
shell_type shell()
|
|
|
|
{
|
|
|
|
return UNIX;
|
|
|
|
}
|
|
|
|
|
2005-01-14 15:53:30 +00:00
|
|
|
|
2005-01-13 10:10:16 +00:00
|
|
|
char path_separator()
|
|
|
|
{
|
|
|
|
return ':';
|
|
|
|
}
|
|
|
|
|
2005-01-14 15:53:30 +00:00
|
|
|
|
|
|
|
void cygwin_path_fix(bool)
|
|
|
|
{}
|
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
} // namespace os
|
|
|
|
} // namespace support
|
|
|
|
} // namespace lyx
|