Skip to content

Commit 9b10344

Browse files
committed
physical paths for copying aars and normalized paths
Normalizing file paths because we observed a mix of forward and backward slashes on Windows. Also, using physical paths instead of logical paths as that seems more stable for copy operations. Bug: 161928545 Fixes googlesamples#392 Change-Id: I6bdfef750a27e509d5e40e046b4a45f2ec5e51d9
1 parent 825901f commit 9b10344

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

source/AndroidResolver/src/GradleTemplateResolver.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,25 @@ private static bool CopySrcAars(ICollection<Dependency> dependencies) {
102102

103103
var aarPath = aar;
104104
if (FileUtils.IsUnderPackageDirectory(aar)) {
105-
var logicalPackagePath = FileUtils.GetPackageDirectory(aar,
106-
FileUtils.PackageDirectoryType.AssetDatabasePath);
105+
// Physical paths work better for copy operations than
106+
// logical Unity paths.
107+
var physicalPackagePath = FileUtils.GetPackageDirectory(aar,
108+
FileUtils.PackageDirectoryType.PhysicalPath);
107109
aarPath = FileUtils.ReplaceBaseAssetsOrPackagesFolder(
108-
aar, logicalPackagePath);
110+
aar, physicalPackagePath);
109111
}
110112
var dir = FileUtils.ReplaceBaseAssetsOrPackagesFolder(
111113
Path.GetDirectoryName(aar),
112114
GooglePlayServices.SettingsDialog.LocalMavenRepoDir);
113115
var filename = Path.GetFileNameWithoutExtension(aarPath);
114116
var targetFilename = Path.Combine(dir, filename + ".aar");
117+
118+
// Avoid situations where we can have a mix of file path
119+
// separators based on platform.
120+
aarPath = FileUtils.NormalizePathSeparators(aarPath);
121+
targetFilename = FileUtils.NormalizePathSeparators(
122+
targetFilename);
123+
115124
bool configuredAar = File.Exists(targetFilename);
116125
if (!configuredAar) {
117126
var error = PlayServicesResolver.CopyAssetAndLabel(

0 commit comments

Comments
 (0)