Updated Processor utility functions to add support for backslashes in paths.

This commit is contained in:
Jonathan Bernard 2014-06-21 19:49:55 +00:00
parent caf96db6c4
commit d58376d025

View File

@ -128,7 +128,7 @@ public class Processor {
// Get the relative path as path elements. // Get the relative path as path elements.
def relPath = getRelativeFilepath(inputRoot, file) def relPath = getRelativeFilepath(inputRoot, file)
def pathParts = relPath.split('/') as List def pathParts = relPath.split('/|\\\\') as List
// We will skip binary files and files we know nothing about. // We will skip binary files and files we know nothing about.
def fileType = sourceTypeForFile(file) def fileType = sourceTypeForFile(file)
@ -304,8 +304,8 @@ public class Processor {
if (!root.isDirectory()) root= root.parentFile if (!root.isDirectory()) root= root.parentFile
/// Split both paths into their individual parts. /// Split both paths into their individual parts.
def rootPath = root.canonicalPath.split('/') def rootPath = root.canonicalPath.split('/|\\\\')
def filePath = file.canonicalPath.split('/') def filePath = file.canonicalPath.split('/|\\\\')
def relativePath = [] def relativePath = []
@ -331,8 +331,8 @@ public class Processor {
* @org jlp.jdb-labs.com/Processor/getCommonParent * @org jlp.jdb-labs.com/Processor/getCommonParent
*/ */
public static File getCommonParent(File file1, File file2) { public static File getCommonParent(File file1, File file2) {
def path1 = file1.canonicalPath.split('/') def path1 = file1.canonicalPath.split('/|\\\\')
def path2 = file2.canonicalPath.split('/') def path2 = file2.canonicalPath.split('/|\\\\')
def newPath = [] def newPath = []
// build new commonPath based on matching paths so far // build new commonPath based on matching paths so far