PDA

View Full Version : Possible JSB2 error with file globbing



jakehurst
7 Jul 2009, 2:24 PM
As I don't have SVN access, I took the jsb2 file from 3.0rc3 and used it for 3.0 final, with the
new JSBuilder2 builder (thanks btw for including the java files in the jar).

Towards the end of the jsb2 file, it looks like this:

resources: [{
src: 'src/',
dest: 'src/',
filters: '*.js'
},{
src: 'examples/',
dest: 'examples/',
filters: '*.html;*.jpg;*.png;*.gif;*.css;*.js'
},{
src: 'resources/',
dest: 'resources/',
filters: '*.*'
}]
}

The filters do not work, the builder gives an error:
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
*.html;*.jpg;*.png;*.gif;*.css;*.js

To solve this, Java pattern matcher needs a true regex, not globs.

I turned it into this:
resources: [{
src: 'src/',
dest: 'src/',
filters: '.*.js'
},{
src: 'examples/',
dest: 'examples/',
filters: '.*.(html|jpg|png|gif|css|js)'
},{
src: 'resources/',
dest: 'resources/',
filters: '.*'
}]

It seems to work after that.
Just FYI. Might want to put in a function to turn globs into regexes into the Java.
I found one here: http://syncdir.sourceforge.net/src/sync/FilterNode.java.html
Though, not sure on the license.

-Justin

aconran
8 Jul 2009, 4:49 AM
Justin -

The filters were changed to regex's and the jsb2 which resides in SVN and now in the download look almost the same as yours.