better support FUSE Lookup()
This commit is contained in:
@@ -65,7 +65,7 @@ func GetFileContent(server string, fileId string) (ret *GetFileContentResult, er
|
||||
}
|
||||
|
||||
type ListDirectoriesResult struct {
|
||||
Directories []DirectoryEntry
|
||||
Directories []DirectoryName
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
@@ -80,6 +80,23 @@ func ListDirectories(server string, directory string) (ret *ListDirectoriesResul
|
||||
return nil, err
|
||||
}
|
||||
|
||||
type LookupDirectoryEntryResult struct {
|
||||
Found bool
|
||||
FileId string
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
func LookupDirectoryEntry(server string, directory string, name string) (ret *LookupDirectoryEntryResult, err error) {
|
||||
ret = new(LookupDirectoryEntryResult)
|
||||
if err := call(server, ApiRequest{Command: "lookupDirectoryEntry", Directory: directory, FileName: name}, ret); err == nil {
|
||||
if ret.Error != "" {
|
||||
return nil, errors.New(ret.Error)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func DeleteDirectoryOrFile(server string, path string, isDir bool) error {
|
||||
destUrl := fmt.Sprintf("http://%s%s", server, path)
|
||||
if isDir {
|
||||
|
||||
Reference in New Issue
Block a user