Skip to content

Commit 1c23023

Browse files
marfx000chkuang-g
authored andcommitted
Fixing maven repo path separator char
This bug happens only if: - "Patch mainTemplate.gradle" setting is enabled; - You are resolving dependencies on Windows platform; Examples of bad repo path string in mainTemplate.gradle: file:///C:/Work/UnityProject\Assets/GeneratedLocalRepo/Firebase/m2repository This happened because Path.Combine uses "\" as path separator for windows platforms. But gradle actually expects not a regular path but file URI, where "/" must be used as path separator.
1 parent 8d9505b commit 1c23023

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/AndroidResolver/src/PlayServicesResolver.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,8 +2143,9 @@ internal static IList<string> GradleMavenReposLines(ICollection<Dependency> depe
21432143
// If "Export Gradle Project" setting is enabled, gradle project expects
21442144
// absolute path.
21452145
if (exportEnabled) {
2146-
repoUri = String.Format("\"{0}\"",
2147-
Path.Combine(projectFileUri, repoPath));
2146+
// build.gradle expects file:/// URI so file separator will be "/" in anycase
2147+
// and we must NOT use Path.Combine here because it will use "\" for win platforms
2148+
repoUri = String.Format("\"{0}/{1}\"", projectFileUri, repoPath);
21482149
} else {
21492150
repoUri = String.Format("(unityProjectPath + \"/{0}\")", repoPath);
21502151
}

0 commit comments

Comments
 (0)