Skip to content

Commit

Permalink
Added IgnoreTask
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkyenus committed Jul 24, 2015
1 parent 0bf18e0 commit f09ee4d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/darkyenus/resourcepacker/tasks/FlattenTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object FlattenTask extends Task {
override def operate(directory: ResourceDirectory): Boolean = {
if (directory.flags.contains("flatten")) {
flatten(directory)
Log.info("Directory flattened. (" + directory + ")")
Log.info(Name, "Directory flattened. (" + directory + ")")
true
} else false
}
Expand Down
27 changes: 27 additions & 0 deletions src/darkyenus/resourcepacker/tasks/IgnoreTask.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package darkyenus.resourcepacker.tasks

import com.esotericsoftware.minlog.Log
import darkyenus.resourcepacker.{ResourceFile, ResourceDirectory, Task}

/**
* Removes all files and directories marked with `.ignore.`
* @author Darkyen
*/
object IgnoreTask extends Task {

override def operate(file: ResourceFile): Boolean = {
if(file.flags.contains("ignore")){
file.removeFromParent()
Log.info(Name, "File ignored. (" + file + ")")
true
}else false
}

override def operate(directory: ResourceDirectory): Boolean = {
if(directory.flags.contains("ignore")){
directory.parent.removeChild(directory)
Log.info(Name, "Directory ignored. (" + directory + ")")
true
}else false
}
}
2 changes: 1 addition & 1 deletion src/darkyenus/resourcepacker/tasks/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ package object tasks {
/**
* Collection of all tasks from this package in logical order.
*/
val DefaultTasks: Seq[Task] = Seq(CreateFontsTask, ConvertModelsTask, FlattenTask, ResizeTask, RasterizeTask, PreBlendTask, PackTask, RemoveEmptyDirectoriesTask)
val DefaultTasks: Seq[Task] = Seq(IgnoreTask, CreateFontsTask, ConvertModelsTask, FlattenTask, ResizeTask, RasterizeTask, PreBlendTask, PackTask, RemoveEmptyDirectoriesTask)
}

0 comments on commit f09ee4d

Please sign in to comment.