fsdef.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package fsdef
  2. /*
  3. fsdef.go
  4. This package handle error related to file systems.
  5. See comments below for usage.
  6. */
  7. import "errors"
  8. var (
  9. /*
  10. READ WRITE PERMISSIONS
  11. */
  12. FsReadOnly = "readonly"
  13. FsWriteOnly = "writeonly"
  14. FsReadWrite = "readwrite"
  15. FsDenied = "denied"
  16. /*
  17. ERROR TYPES
  18. */
  19. //Redirective Error
  20. ErrRedirectParent = errors.New("Redirect:parent")
  21. ErrRedirectCurrentRoot = errors.New("Redirect:root")
  22. ErrRedirectUserRoot = errors.New("Redirect:userroot")
  23. //Resolve errors
  24. ErrVpathResolveFailed = errors.New("FS_VPATH_RESOLVE_FAILED")
  25. ErrRpathResolveFailed = errors.New("FS_RPATH_RESOLVE_FAILED")
  26. ErrFSHNotFOund = errors.New("FS_FILESYSTEM_HANDLER_NOT_FOUND")
  27. //Operation errors
  28. ErrOperationNotSupported = errors.New("FS_OPR_NOT_SUPPORTED")
  29. ErrNullOperation = errors.New("FS_NULL_OPR")
  30. )
  31. //Generate a File Manager redirection error message
  32. func NewRedirectionError(targetVpath string) error {
  33. return errors.New("Redirect:" + targetVpath)
  34. }
  35. //Check if a file system is network drive
  36. func IsNetworkDrive(fstype string) bool {
  37. if fstype == "webdav" || fstype == "ftp" {
  38. return true
  39. }
  40. return false
  41. }