You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
912 B
30 lines
912 B
package wow.doge.mygame
|
|
|
|
import org.scalatest.funsuite.AnyFunSuite
|
|
import cats.effect.{Resource => CResource}
|
|
import monix.eval.Task
|
|
import scala.concurrent.duration._
|
|
|
|
class FileWatcherTest extends AnyFunSuite {
|
|
test("1") {
|
|
import better.files._
|
|
import io.methvin.better.files._
|
|
|
|
val myDir =
|
|
File((os.pwd / "assets" / "scripts").toString)
|
|
val watcher = new RecursiveFileMonitor(myDir) {
|
|
override def onCreate(file: File, count: Int) =
|
|
println(s"$file got created")
|
|
override def onModify(file: File, count: Int) =
|
|
println(s"$file got modified $count times")
|
|
override def onDelete(file: File, count: Int) =
|
|
println(s"$file got deleted")
|
|
}
|
|
|
|
import monix.execution.Scheduler.Implicits.global
|
|
CResource
|
|
.make(Task { watcher.start(); watcher })(w => Task(w.stop()))
|
|
.use(_ => Task.never)
|
|
.runSyncUnsafe(10.seconds)
|
|
}
|
|
}
|