#include <config.h>
#include "support/os.h"
+#include "support/docstring.h"
+#include "support/FileName.h"
+#include "support/lstrings.h"
+
+#include <limits.h>
+#include <stdlib.h>
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
-using std::string;
-
+using namespace std;
namespace lyx {
namespace support {
}
+bool isFilesystemCaseSensitive()
+{
+#ifdef __APPLE__
+ return false;
+#else
+ return true;
+#endif
+}
+
+
docstring::size_type common_path(docstring const & p1, docstring const & p2)
{
docstring::size_type i = 0;
}
-bool is_absolute_path(string const & p)
+bool is_valid_strftime(string const & p)
{
- return !p.empty() && p[0] == '/';
+ string::size_type pos = p.find_first_of('%');
+ while (pos != string::npos) {
+ if (pos + 1 == string::npos)
+ break;
+ if (!containsOnly(p.substr(pos + 1, 1),
+ "aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
+ return false;
+ if (pos + 2 == string::npos)
+ break;
+ pos = p.find_first_of('%', pos + 2);
+ }
+ return true;
}
}
+bool is_terminal(io_channel channel)
+{
+ return isatty(channel);
+}
+
+
shell_type shell()
{
return UNIX;
#endif
}
+
+string real_path(string const & path)
+{
+ char rpath[PATH_MAX + 1];
+ char * result = realpath(path.c_str(), rpath);
+ return FileName::fromFilesystemEncoding(result ? rpath : path).absFilename();
+}
+
} // namespace os
} // namespace support
} // namespace lyx