Great! I was actually looking for a way to do it with pattern matching, but
did not find a way to translate 3 independent Boolean responses to cases.
That is what I was looking for. Forgot about if within the case...
 On Sep 14, 2013 8:25 AM, "Josh Albrecht" <notifications@github.com> wrote:

> In src/main/scala/com/codexica/s3crate/filetree/local/LinuxFileTree.scala:
>
> > @@ -19,7 +61,26 @@ class LinuxFileTree(baseFolder: File, ec: ExecutionContext) extends LocalFileTre
> >     * @throws InaccessibleDataError wrapping all other non fatal errors
> >     * @return Return the appropriate FilePathType (folder, file, or symlink)
> >     */
> > -  def getFileType(file: File): FilePathType = throw new NotImplementedError()
> > +  def getFileType(file: File): FilePathType = {
> > +    //get Path from File
> > +    val path = getPath(file)
> > +    try {
> > +      //check for SymLink
> > +      if (Files.isSymbolicLink(path)) SymLinkType()
> > +      //check for directory
> > +      else if (Files.isDirectory(path)) FolderType()
> > +      //check for file (we can probably skip this check and return FileType, as no other
> > +      //option currently exists. This is a precaution against the unknown
> > +      else if (Files.isRegularFile(path)) FileType()
> > +      //if not check succeeded - throw our generic InaccessibleDataError
> > +      else throw new InaccessibleDataError("wierd error. path is not a file, a directory or a symlink", null)
>
> Also, this whole block is possible to do in a more Scala-istic way:
>
> path match {
>   case p if (Files.isSymbolicLink(p)) => SymLinkType()
>   case p if (Files.isDirectory(p)) => FolderType()
>   case p if (Files.isRegularFile(p)) => FileType()
>   case _ => throw new Exception("wierd error. path (${file.toURI}) is not a file, a directory or a symlink", null)
> }
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/joshalbrecht/s3crate/pull/1/files#r6364023>
> .
>