@@ -9,56 +9,66 @@ import (
9
9
10
10
// PathExists returns true if path exists.
11
11
// All errors causes to return false.
12
- func (e * Session ) PathExists (path string ) bool {
12
+ func (e * Session ) PathExists (path string , args ... interface {}) bool {
13
+ path = applySprintfIfNeeded (path , args ... )
13
14
return fs .PathWithVars (path , e .vars ).Exists ()
14
15
}
15
16
16
17
// MkDir creates a directory at specified path with mode value.
17
18
// FSInfo contains information about the path or error if occured
18
- func (e * Session ) MkDir (path string , mode os.FileMode ) * fs.FSInfo {
19
+ func (e * Session ) MkDir (path string , mode os.FileMode , args ... interface {}) * fs.FSInfo {
20
+ path = applySprintfIfNeeded (path , args ... )
19
21
p := fs .PathWithVars (path , e .vars )
20
22
return p .MkDir (mode )
21
23
}
22
24
23
25
// RmPath removes specified path (dir or file).
24
26
// Error is returned FSInfo.Err()
25
- func (e * Session ) RmPath (path string ) * fs.FSInfo {
27
+ func (e * Session ) RmPath (path string , args ... interface {}) * fs.FSInfo {
28
+ path = applySprintfIfNeeded (path , args ... )
26
29
p := fs .PathWithVars (path , e .vars )
27
30
return p .Remove ()
28
31
}
29
32
30
33
// PathInfo
31
- func (e * Session ) PathInfo (path string ) * fs.FSInfo {
34
+ func (e * Session ) PathInfo (path string , args ... interface {}) * fs.FSInfo {
35
+ path = applySprintfIfNeeded (path , args ... )
32
36
return fs .PathWithVars (path , e .vars ).Info ()
33
37
}
34
38
35
39
// FileReadWithContext uses specified context to provide methods to read file
36
40
// content at path.
37
- func (e * Session ) FileReadWithContext (ctx context.Context , path string ) * fs.FileReader {
41
+ func (e * Session ) FileReadWithContext (ctx context.Context , path string , args ... interface {}) * fs.FileReader {
42
+ path = applySprintfIfNeeded (path , args ... )
38
43
return fs .ReadWithContextVars (ctx , path , e .vars )
39
44
}
40
45
41
46
// FileRead provides methods to read file content
42
- func (e * Session ) FileRead (path string ) * fs.FileReader {
47
+ func (e * Session ) FileRead (path string , args ... interface {}) * fs.FileReader {
48
+ path = applySprintfIfNeeded (path , args ... )
43
49
return fs .ReadWithContextVars (context .Background (), path , e .vars )
44
50
}
45
51
46
52
// FileWriteWithContext uses context ctx to create a fs.FileWriter to write content to provided path
47
- func (e * Session ) FileWriteWithContext (ctx context.Context , path string ) * fs.FileWriter {
53
+ func (e * Session ) FileWriteWithContext (ctx context.Context , path string , args ... interface {}) * fs.FileWriter {
54
+ path = applySprintfIfNeeded (path , args ... )
48
55
return fs .WriteWithContextVars (ctx , path , e .vars )
49
56
}
50
57
51
58
// FileWrite creates a fs.FileWriter to write content to provided path
52
- func (e * Session ) FileWrite (path string ) * fs.FileWriter {
59
+ func (e * Session ) FileWrite (path string , args ... interface {}) * fs.FileWriter {
60
+ path = applySprintfIfNeeded (path , args ... )
53
61
return fs .WriteWithContextVars (context .Background (), path , e .vars )
54
62
}
55
63
56
64
// FileAppend creates a new fs.FileWriter to append content to provided path
57
- func (e * Session ) FileAppendWithContext (ctx context.Context , path string ) * fs.FileWriter {
65
+ func (e * Session ) FileAppendWithContext (ctx context.Context , path string , args ... interface {}) * fs.FileWriter {
66
+ path = applySprintfIfNeeded (path , args ... )
58
67
return fs .AppendWithContextVars (ctx , path , e .vars )
59
68
}
60
69
61
70
// FileAppend creates a new fs.FileWriter to append content to provided path
62
- func (e * Session ) FileAppend (path string ) * fs.FileWriter {
71
+ func (e * Session ) FileAppend (path string , args ... interface {}) * fs.FileWriter {
72
+ path = applySprintfIfNeeded (path , args ... )
63
73
return fs .AppendWithContextVars (context .Background (), path , e .vars )
64
74
}
0 commit comments