-- internals

forRegularFilePath :: Config -> Path -> (Types.Pathname -> I.Int64 -> IO a) -> IO a
forRegularFilePath config path action = do
  fileStatus <- listStatus config path
  if length fileStatus /= 1
    then error $ path ++ " is not a regular file: " ++ (show fileStatus)
    else action (toThriftPath path) (filesize fileStatus)
    where
      filesize = Types.fileStatus_length . head
forRegularFilePath :: Config -> Path -> (Types.Pathname -> I.Int64 -> IO a) -> IO a
forRegularFilePath config path action = do
  fileStatus <- listStatus config path
  if length fileStatus /= 1
    then error $ path ++ " is not a regular file: " ++ (show fileStatus)
    else action (toThriftPath path) (filesize fileStatus)
    where
      filesize = Types.fileStatus_length . head
forRegularFilePath config path action = do
  fileStatus <- listStatus config path
  if length fileStatus /= 1
    then error $ path ++ " is not a regular file: " ++ (show fileStatus)
    else action (toThriftPath path) (filesize fileStatus)
    where
      filesize = Types.fileStatus_length . head