[stringtemplate-interest] Unit test failing on Windows

Gael Marziou gael.marziou at free.fr
Fri Nov 6 16:58:25 PST 2009


I understood why the testCannotFindInterfaceFile() unit test fails on 
Windows: the PathGroupLoader use ":" as path separator.
Problem is that a directory in Windows uses this for drive letter.
So when you get a directory "C:\Users\Gael\AppData\Local\Temp\", this 
code below considers as 2 parts : "c" and the remaining.

Gael

     public PathGroupLoader(String dirStr, StringTemplateErrorListener 
errors) {
         this.errors = errors;
         StringTokenizer tokenizer = new StringTokenizer(dirStr, ":", 
false);
         while (tokenizer.hasMoreElements()) {
             String dir = (String) tokenizer.nextElement();
             if ( dirs==null ) {
                 dirs = new ArrayList();
             }
             dirs.add(dir);
         }
     }





More information about the stringtemplate-interest mailing list