fix > issue #3 compatible with Linux & MacOS

master
lihengming 8 years ago
parent 4470897e54
commit def70c75ff
  1. 8
      src/test/java/CodeGenerator.java

@ -22,10 +22,10 @@ public class CodeGenerator {
private static final String JDBC_DIVER_CLASS_NAME = "com.mysql.jdbc.Driver"; private static final String JDBC_DIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
private static final String PROJECT_PATH = System.getProperty("user.dir");//项目在硬盘上的基础路径 private static final String PROJECT_PATH = System.getProperty("user.dir");//项目在硬盘上的基础路径
private static final String TEMPLATE_FILE_PATH = PROJECT_PATH + "\\src\\test\\resources\\generator\\template";//模板位置 private static final String TEMPLATE_FILE_PATH = PROJECT_PATH + "/src/test/resources/generator/template";//模板位置
private static final String JAVA_PATH = "\\src\\main\\java"; //java文件路径 private static final String JAVA_PATH = "/src/main/java"; //java文件路径
private static final String RESOURCES_PATH = "\\src\\main\\resources";//资源文件路径 private static final String RESOURCES_PATH = "/src/main/resources";//资源文件路径
private static final String PACKAGE_PATH_SERVICE = packageConvertPath(SERVICE_PACKAGE);//生成的Service存放路径 private static final String PACKAGE_PATH_SERVICE = packageConvertPath(SERVICE_PACKAGE);//生成的Service存放路径
private static final String PACKAGE_PATH_SERVICE_IMPL = packageConvertPath(SERVICE_IMPL_PACKAGE);//生成的Service实现存放路径 private static final String PACKAGE_PATH_SERVICE_IMPL = packageConvertPath(SERVICE_IMPL_PACKAGE);//生成的Service实现存放路径
@ -214,6 +214,6 @@ public class CodeGenerator {
} }
private static String packageConvertPath(String packageName) { private static String packageConvertPath(String packageName) {
return String.format("\\%s\\", packageName.contains(".") ? packageName.replaceAll("\\.", "\\\\") : packageName); return String.format("/%s/", packageName.contains(".") ? packageName.replaceAll("\\.", "/") : packageName);
} }
} }

Loading…
Cancel
Save