Skip to content

Commit

Permalink
Fix: handle empty Moveslink folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSpanel committed May 8, 2018
1 parent 6ff81be commit 99799ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt.Keys.scalacOptions

lazy val commonSettings = Seq(
organization := "com.github.ondrejspanel",
version := "0.1.9-beta",
version := "0.1.10-beta",
scalaVersion := "2.11.12",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ object MoveslinkFiles {
// no need to sync Moveslink settings files, we want only activities
private def exclude = Seq("library.xml", "settings.xml")

def listQuestFiles: Set[String] = getDataFolder.list.toSet.filter(name => name.endsWith(".xml") && name.toLowerCase.startsWith("quest_"))
private def safeFileSet(file: File) = {
val ss = Option(file.list).toSet
ss.flatMap(s => s.toSet)
}

def listQuestFiles: Set[String] = safeFileSet(getDataFolder).filter(name => name.endsWith(".xml") && name.toLowerCase.startsWith("quest_"))

def listMoveslink2Files: Set[String] = getData2Folder.list.toSet.filter(f => f.endsWith(".sml") || f.endsWith(".xml") && !exclude.contains(f.toLowerCase))
def listMoveslink2Files: Set[String] = safeFileSet(getData2Folder).filter(f => f.endsWith(".sml") || f.endsWith(".xml") && !exclude.contains(f.toLowerCase))

def listFiles: Set[String] = listQuestFiles.map(placeInFolder(moveslinkFolder, _)) ++ listMoveslink2Files.map(placeInFolder(moveslink2Folder, _))

Expand Down

0 comments on commit 99799ff

Please sign in to comment.