blob: 75688e958fa4c1ce483c2514454ef0c34fb36248 (
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
|
#include <u.h>
#include <libn.h>
int
os·exists(byte *path, int flag)
{
return access(path, flag) == 0;
}
int
os·sep(void)
{
#if defined(UNIX) || defined(__linux__)
return '/';
#elif defined(WIN32)
return '\\';
#else
panicf("unrecognized operating system");
return '\0';
#endif
}
byte*
os·basename(byte *path)
{
byte *sep;
sep = utf8·findrrune(path, os·sep());
return (sep == nil) ? path : sep+1;
}
|