mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 08:48:51 -05:00
* helper for enforcing filename length limits
This commit is contained in:
parent
03ab54ddcc
commit
f50e0450c6
@ -51,6 +51,9 @@ String.metaClass.hasExtension = { String... ext -> hasExtension(delegate, ext) }
|
||||
String.metaClass.validateFileName = { validateFileName(delegate) }
|
||||
String.metaClass.validateFilePath = { validateFilePath(delegate) }
|
||||
|
||||
// helper for enforcing filename length limits, e.g. truncate filename but keep extension
|
||||
String.metaClass.truncateFileName = { int limit = 255 -> def ext = getExtension(delegate); def name = getNameWithoutExtension(delegate); return name.substring(0, Math.min(limit - (ext ? 1+ext.length() : 0), name.length())) + (ext ? '.'+ext : '') }
|
||||
|
||||
|
||||
// Parallel helper
|
||||
import java.util.concurrent.*
|
||||
|
Loading…
Reference in New Issue
Block a user