Skip to content

Commit

Permalink
[FIXED JENKINS-4836] SLOCCount plugin fails with Windows/Cygwin SLOCC…
Browse files Browse the repository at this point in the history
…ount execution
  • Loading branch information
Karsten Brandt authored and Karsten Brandt committed Jun 15, 2012
1 parent 2d0f2d6 commit 510d0a7
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -185,5 +190,4 @@ public void simplifyNames(){
public String getName() {
return "SlocCount Report";
}

}

0 comments on commit 510d0a7

Please sign in to comment.