@@ -121,11 +121,6 @@ internal static Dictionary<string, string> DependenciesToPackageSpecs(
121
121
return sourcesByPackageSpec ;
122
122
}
123
123
124
- // Special characters that should not be escaped in URIs for Gradle property values.
125
- private static HashSet < string > GradleUriExcludeEscapeCharacters = new HashSet < string > {
126
- ":"
127
- } ;
128
-
129
124
/// <summary>
130
125
/// Convert a repo path to a valid URI.
131
126
/// If the specified repo is a local directory and it doesn't exist, search the project
@@ -145,40 +140,31 @@ internal static string RepoPathToUri(string repoPath, string sourceLocation=null
145
140
if ( repoPath . StartsWith ( PlayServicesSupport . SdkVariable ) ) return null ;
146
141
// Since we need a URL, determine whether the repo has a scheme. If not,
147
142
// assume it's a local file.
148
- bool validScheme = false ;
149
143
foreach ( var scheme in new [ ] { "file:" , "http:" , "https:" } ) {
150
- validScheme |= repoPath . StartsWith ( scheme ) ;
144
+ if ( repoPath . StartsWith ( scheme ) ) return GradleWrapper . EscapeUri ( repoPath ) ;
151
145
}
152
- if ( ! validScheme ) {
153
- // If the directory isn't found, it is possible the user has moved the repository
154
- // in the project, so try searching for it.
155
- string searchDir = "Assets" + Path . DirectorySeparatorChar ;
156
- if ( ! Directory . Exists ( repoPath ) &&
157
- FileUtils . NormalizePathSeparators ( repoPath . ToLower ( ) ) . StartsWith (
158
- searchDir . ToLower ( ) ) ) {
159
- var foundPath = FileUtils . FindPathUnderDirectory (
160
- searchDir , repoPath . Substring ( searchDir . Length ) ) ;
161
- string warningMessage ;
162
- if ( ! String . IsNullOrEmpty ( foundPath ) ) {
163
- repoPath = searchDir + foundPath ;
164
- warningMessage = String . Format (
165
- "{0}: Repo path '{1}' does not exist, will try using '{2}' instead." ,
166
- sourceLocation , repoPath , foundPath ) ;
167
- } else {
168
- warningMessage = String . Format (
169
- "{0}: Repo path '{1}' does not exist." , sourceLocation , repoPath ) ;
170
- }
171
- PlayServicesResolver . Log ( warningMessage , level : LogLevel . Warning ) ;
172
- }
173
146
174
- repoPath = PlayServicesResolver . FILE_SCHEME +
175
- FileUtils . PosixPathSeparators ( Path . GetFullPath ( repoPath ) ) ;
147
+ // If the directory isn't found, it is possible the user has moved the repository
148
+ // in the project, so try searching for it.
149
+ string searchDir = "Assets" + Path . DirectorySeparatorChar ;
150
+ if ( ! Directory . Exists ( repoPath ) &&
151
+ FileUtils . NormalizePathSeparators ( repoPath . ToLower ( ) ) . StartsWith (
152
+ searchDir . ToLower ( ) ) ) {
153
+ var foundPath = FileUtils . FindPathUnderDirectory (
154
+ searchDir , repoPath . Substring ( searchDir . Length ) ) ;
155
+ string warningMessage ;
156
+ if ( ! String . IsNullOrEmpty ( foundPath ) ) {
157
+ repoPath = searchDir + foundPath ;
158
+ warningMessage = String . Format (
159
+ "{0}: Repo path '{1}' does not exist, will try using '{2}' instead." ,
160
+ sourceLocation , repoPath , foundPath ) ;
161
+ } else {
162
+ warningMessage = String . Format (
163
+ "{0}: Repo path '{1}' does not exist." , sourceLocation , repoPath ) ;
164
+ }
165
+ PlayServicesResolver . Log ( warningMessage , level : LogLevel . Warning ) ;
176
166
}
177
- // Escape the URI to handle special characters like spaces and percent escape
178
- // all characters that are interpreted by gradle.
179
- return GradleWrapper . EscapeGradlePropertyValue (
180
- Uri . EscapeUriString ( repoPath ) , escapeFunc : Uri . EscapeDataString ,
181
- charactersToExclude : GradleUriExcludeEscapeCharacters ) ;
167
+ return GradleWrapper . EscapeUri ( GradleWrapper . PathToFileUri ( repoPath ) ) ;
182
168
}
183
169
184
170
/// <summary>
0 commit comments