#include "support/FileName.h"
#include "support/lstrings.h"
-#include <sys/stat.h>
+#include <limits.h>
+#include <stdlib.h>
#ifdef __APPLE__
#include <Carbon/Carbon.h>
}
+bool is_terminal(io_channel channel)
+{
+ return isatty(channel);
+}
+
+
shell_type shell()
{
return UNIX;
}
-bool isSameFile(string const & fileone, string const & filetwo)
+string real_path(string const & path)
{
- struct stat st1;
- struct stat st2;
-
- if (::stat(fileone.c_str(), &st1) == 0
- && ::stat(filetwo.c_str(), &st2) == 0) {
- return st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev;
- }
-
- // One or both files cannot be accessed.
- return false;
+ char rpath[PATH_MAX + 1];
+ char * result = realpath(path.c_str(), rpath);
+ return FileName::fromFilesystemEncoding(result ? rpath : path).absFilename();
}
} // namespace os