blob: 01483f1702250dcd6c69103b802e5be746eeeb02 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#ifndef TENSORFLOW_LIB_IO_PATH_H_
#define TENSORFLOW_LIB_IO_PATH_H_
#include "tensorflow/core/lib/core/stringpiece.h"
#include "tensorflow/core/public/status.h"
namespace tensorflow {
class StringPiece;
namespace io {
// Utility routines for processing filenames
// Join multiple paths together, without introducing unnecessary path
// separators.
// For example:
//
// Arguments | JoinPath
// ---------------------------+----------
// '/foo', 'bar' | /foo/bar
// '/foo/', 'bar' | /foo/bar
// '/foo', '/bar' | /foo/bar
//
// Usage:
// string path = io::JoinPath("/mydir", filename);
// string path = io::JoinPath(FLAGS_test_srcdir, filename);
string JoinPath(StringPiece part1, StringPiece part2);
// Return true if path is absolute.
bool IsAbsolutePath(StringPiece path);
// Returns the part of the path before the final "/". If there is a single
// leading "/" in the path, the result will be the leading "/". If there is
// no "/" in the path, the result is the empty prefix of the input.
StringPiece Dirname(StringPiece path);
// Returns the part of the path after the final "/". If there is no
// "/" in the path, the result is the same as the input.
StringPiece Basename(StringPiece path);
// Returns the part of the basename of path after the final ".". If
// there is no "." in the basename, the result is empty.
StringPiece Extension(StringPiece path);
} // namespace io
} // namespace tensorflow
#endif // TENSORFLOW_LIB_IO_PATH_H_
|