fix reg expression

This commit is contained in:
wing328 2015-06-23 22:30:43 +08:00
parent 351833a923
commit d18426c69a

View File

@ -99,14 +99,20 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
basePath = basePath.replaceAll("[\\\\/]?$", "") + File.separatorChar;
}
String regFirstPathSeparator;
if ("/".equals(File.separator)) { // for mac, linux
regFirstPathSeparator = "^/";
} else { // for windows
regFirstPathSeparator = "^\\";
}
return (getPackagePath() + File.separatorChar + basePath
// Replace period, backslash, forward slash with file separator in package name
+ packageName.replace("\\", File.separator).
replace(".", File.separator).replace("/", File.separator));
+ packageName.replaceAll("[\\.\\\\/]", File.separator)
// Trim prefix file separators from package path
//.replaceAll("^" + File.separator, ""))
.replaceAll(regFirstPathSeparator, ""))
// Trim trailing file separators from the overall path
//.replaceAll(File.separator + "$", "");
.replaceAll(File.separator + "$", "");
}
public CodegenType getTag() {