fix[generate]: join root path and generate path

This commit is contained in:
godotg
2024-01-15 18:53:49 +08:00
parent 441cd023dd
commit d5e1f495df
9 changed files with 9 additions and 54 deletions
@@ -62,12 +62,7 @@ public abstract class GenerateCppUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
cppSerializerMap = new HashMap<>();
@@ -58,12 +58,7 @@ public abstract class GenerateCsUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
csSerializerMap = new HashMap<>();
@@ -61,12 +61,7 @@ public abstract class GenerateGdUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
gdSerializerMap = new HashMap<>();
@@ -56,12 +56,7 @@ public abstract class GenerateGoUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
goSerializerMap = new HashMap<>();
@@ -55,12 +55,7 @@ public abstract class GenerateJsUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
jsSerializerMap = new HashMap<>();
@@ -57,12 +57,7 @@ public abstract class GenerateLuaUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
luaSerializerMap = new HashMap<>();
@@ -48,12 +48,7 @@ public abstract class GeneratePbUtils {
public static final int COMPATIBLE_FIELD_TAG = 1000;
public static void create(PbGenerateOperation pbGenerateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isEmpty(pbGenerateOperation.getOutputPath())) {
protocolOutputPath = FileUtils.joinPath(pbGenerateOperation.getOutputPath(), protocolOutputRootPath);
} else {
protocolOutputPath = pbGenerateOperation.getOutputPath();
}
protocolOutputPath = FileUtils.joinPath(pbGenerateOperation.getOutputPath(), protocolOutputRootPath);
// java package path
if (StringUtils.isNotEmpty(pbGenerateOperation.getJavaPackage())) {
protocolOutputPath = protocolOutputPath + File.separator + pbGenerateOperation.getJavaPackage().replaceAll(StringUtils.PERIOD_REGEX, "/");
@@ -57,12 +57,7 @@ public abstract class GeneratePyUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
pySerializerMap = new HashMap<>();
@@ -58,12 +58,7 @@ public abstract class GenerateTsUtils {
}
public static void init(GenerateOperation generateOperation) {
// if not specify output path, then use current default path
if (StringUtils.isNotEmpty(generateOperation.getProtocolPath())) {
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
} else {
protocolOutputPath = generateOperation.getProtocolPath();
}
protocolOutputPath = FileUtils.joinPath(generateOperation.getProtocolPath(), protocolOutputRootPath);
FileUtils.deleteFile(new File(protocolOutputPath));
tsSerializerMap = new HashMap<>();