blob: 42e183e79cf69607291176f020fa7a8cd8cc5b18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "filesystem.h"
#ifndef _MSC_VER
// don't include these on Windows:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
namespace marian {
namespace filesystem {
#ifdef _MSC_VER
// Pretend that Windows knows no named pipes. It does, by the way, but
// they seem to be different from pipes on Unix / Linux. See
// https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipes
bool is_fifo(char const* /*path*/) {
return false;
}
#else
bool is_fifo(char const* path) {
struct stat buf;
stat(path, &buf);
return S_ISFIFO(buf.st_mode);
}
#endif
bool is_fifo(std::string const& path) {
return is_fifo(path.c_str());
}
} // end of namespace marian::filesystem
} // end of namespace marian
|