mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-09 20:00:21 +08:00
fix intellij gradle build issue with incorrect file protocol syntax
This commit is contained in:
parent
ba951ce744
commit
7029579534
@ -171,18 +171,18 @@ public class EnablePrivateAccessTranslator extends BaseTranslator {
|
||||
cls = Class.forName(sourceClassFullName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (System.getProperty(IDEA_PATHS_SELECTOR) != null) {
|
||||
// fit for intellij 2020.3+
|
||||
// fit for intellij build
|
||||
String sourceFileWrapperString = clazz.sourcefile.toString();
|
||||
String sourceFilePath = sourceFileWrapperString.substring(
|
||||
sourceFileWrapperString.lastIndexOf("[") + 1, sourceFileWrapperString.indexOf("]"));
|
||||
int indexOfSrc = sourceFilePath.lastIndexOf(File.separator + "src" + File.separator);
|
||||
String basePath = sourceFilePath.substring(0, indexOfSrc);
|
||||
String targetFolderPath = PathUtil.fitPathString(basePath + MAVEN_CLASS_FOLDER);
|
||||
try {
|
||||
String targetFolderPath = PathUtil.fitPathString(basePath + MAVEN_CLASS_FOLDER);
|
||||
cls = loadClass(targetFolderPath, sourceClassFullName);
|
||||
} catch (ClassNotFoundException e2) {
|
||||
targetFolderPath = PathUtil.fitPathString(basePath + GRADLE_CLASS_FOLDER);
|
||||
cls = loadClass(targetFolderPath, sourceClassFullName);
|
||||
String buildFolderPath = PathUtil.fitPathString(basePath + GRADLE_CLASS_FOLDER);
|
||||
cls = loadClass(buildFolderPath, sourceClassFullName);
|
||||
}
|
||||
} else {
|
||||
// fit for gradle build
|
||||
|
@ -6,7 +6,7 @@ public class PathUtil {
|
||||
private static final String PROPERTY_OS_NAME = "os.name";
|
||||
private static final String PATH_SPLIT_UNIX = "/";
|
||||
private static final String PATH_SPLIT_WIN = "\\\\";
|
||||
private static final String PROTOCOL_FILE = "file:/";
|
||||
private static final String PROTOCOL_FILE = "file:";
|
||||
|
||||
/**
|
||||
* Fit path according to operation system type
|
||||
|
Loading…
Reference in New Issue
Block a user