Skip to content
Permalink
Browse files
[FIXED JENKINS-4836] SLOCCount plugin fails with Windows/Cygwin SLOCC…
…ount execution
  • Loading branch information
Karsten Brandt authored and Karsten Brandt committed Jun 15, 2012
1 parent 2d0f2d6 commit 510d0a7611d8a31e2bccb0c7bbd7e21bcf6c600d
Showing 1 changed file with 8 additions and 4 deletions.
@@ -18,13 +18,18 @@ public class SloccountReport extends FileContainer {
/** The longest folder path common to all folders. */
private String[] rootFolderPath = null;
private transient String fileSeparator;
private transient String regex_fileSeparator;

public SloccountReport(){
super();
this.fileSeparator = System.getProperty("file.separator");

if(this.fileSeparator.equals("\\")){
// escape the backslash if required (fileSeparator is used as a regex)
this.fileSeparator = "\\\\";
// Windows environment -> escape the backslash for regex
this.regex_fileSeparator = "\\\\";
}else{
// Unix environment -> use as given
this.regex_fileSeparator = this.fileSeparator;
}
}

@@ -120,7 +125,7 @@ public String getRootFolder(){
}

private void updateRootFolderPath(String newFolderName){
String[] newFolderPath = newFolderName.split(this.fileSeparator);
String[] newFolderPath = newFolderName.split(this.regex_fileSeparator);

if(this.rootFolderPath == null){
this.rootFolderPath = newFolderPath;
@@ -185,5 +190,4 @@ public void simplifyNames(){
public String getName() {
return "SlocCount Report";
}

}

0 comments on commit 510d0a7

Please sign in to comment.