aboutsummaryrefslogtreecommitdiffstats
path: root/util/folder/path.pxd
blob: 85af10d746b91b63524bebacce3844ba7a40ae12 (plain) (blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from util.generic.string cimport TString, TStringBuf
from util.generic.vector cimport TVector


# NOTE (danila-eremin) Currently not possible to use `const` and `except +` at the same time, so some function not marked const
cdef extern from "util/folder/path.h" nogil:
    cdef cppclass TFsPath:
        TFsPath() except +
        TFsPath(const TString&) except +
        TFsPath(const TStringBuf) except +
        TFsPath(const char*) except +

        void CheckDefined() except +

        bint IsDefined() const
        bint operator bool() const

        const char* c_str() const

        bint operator==(const TFsPath&) const
        bint operator!=(const TFsPath&) const

        # NOTE (danila-eremin) operator `/=` Not supported
        # TFsPath& operator/=(const TFsPath&) const

        TFsPath operator/(const TFsPath&, const TFsPath&) except +

        # NOTE (danila-eremin) TPathSplit needed
        # const TPathSplit& PathSplit() const

        TFsPath& Fix() except +

        const TString& GetPath() const
        TString GetName() const

        TString GetExtension() const

        bint IsAbsolute() const
        bint IsRelative() const

        bint IsSubpathOf(const TFsPath&) const
        bint IsNonStrictSubpathOf(const TFsPath&) const
        bint IsContainerOf(const TFsPath&) const

        TFsPath RelativeTo(const TFsPath&) except +
        TFsPath RelativePath(const TFsPath&) except +

        TFsPath Parent() const

        TString Basename() const
        TString Dirname() const

        TFsPath Child(const TString&) except +

        void MkDir() except +
        void MkDir(const int) except +
        void MkDirs() except +
        void MkDirs(const int) except +

        void List(TVector[TFsPath]&) except +
        void ListNames(TVector[TString]&) except +

        bint Contains(const TString&) const

        void DeleteIfExists() except +
        void ForceDelete() except +

        # NOTE (danila-eremin) TFileStat needed
        # bint Stat(TFileStat&) const

        bint Exists() const
        bint IsDirectory() const
        bint IsFile() const
        bint IsSymlink() const
        void CheckExists() except +

        void RenameTo(const TString&) except +
        void RenameTo(const char*) except +
        void RenameTo(const TFsPath&) except +
        void ForceRenameTo(const TString&) except +

        void CopyTo(const TString&, bint) except +

        void Touch() except +

        TFsPath RealPath() except +
        TFsPath RealLocation() except +
        TFsPath ReadLink() except +

        @staticmethod
        TFsPath Cwd() except +

        void Swap(TFsPath&)