forked from Elara6331/itd
Allow multiple paths in mkdir and remove
This commit is contained in:
parent
0720feba96
commit
49a7a51527
10
api/fs.go
10
api/fs.go
@ -19,12 +19,12 @@ func (c *Client) Rename(old, new string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Remove(path string) error {
|
func (c *Client) Remove(paths ...string) error {
|
||||||
_, err := c.request(types.Request{
|
_, err := c.request(types.Request{
|
||||||
Type: types.ReqTypeFS,
|
Type: types.ReqTypeFS,
|
||||||
Data: types.ReqDataFS{
|
Data: types.ReqDataFS{
|
||||||
Type: types.FSTypeDelete,
|
Type: types.FSTypeDelete,
|
||||||
Files: []string{path},
|
Files: paths,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -33,12 +33,12 @@ func (c *Client) Remove(path string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Mkdir(path string) error {
|
func (c *Client) Mkdir(paths ...string) error {
|
||||||
_, err := c.request(types.Request{
|
_, err := c.request(types.Request{
|
||||||
Type: types.ReqTypeFS,
|
Type: types.ReqTypeFS,
|
||||||
Data: types.ReqDataFS{
|
Data: types.ReqDataFS{
|
||||||
Type: types.FSTypeMkdir,
|
Type: types.FSTypeMkdir,
|
||||||
Files: []string{path},
|
Files: paths,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -86,7 +86,7 @@ func (c *Client) WriteFile(path, data string) error {
|
|||||||
Data: types.ReqDataFS{
|
Data: types.ReqDataFS{
|
||||||
Type: types.FSTypeRead,
|
Type: types.FSTypeRead,
|
||||||
Files: []string{path},
|
Files: []string{path},
|
||||||
Data: data,
|
Data: data,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user