@@ -72,7 +72,7 @@ public class MonoTouchSdk
72
72
73
73
DateTime lastMTExeWrite = DateTime . MinValue ;
74
74
PDictionary versions ;
75
- bool hasUsrSubdir ;
75
+ string mtouchPath ;
76
76
77
77
static MonoTouchSdk ( )
78
78
{
@@ -94,13 +94,15 @@ public MonoTouchSdk (string sdkDir)
94
94
95
95
public string BinDir {
96
96
get {
97
- return Path . Combine ( SdkDir , hasUsrSubdir ? "usr/bin" : "bin" ) ;
97
+ // mtouch is in the bin dir
98
+ return Path . GetDirectoryName ( mtouchPath ) ;
98
99
}
99
100
}
100
101
101
102
public string LibDir {
102
103
get {
103
- return Path . Combine ( SdkDir , hasUsrSubdir ? "usr/lib" : "lib" ) ;
104
+ // the lib dir is next to the bin dir
105
+ return Path . Combine ( Path . GetDirectoryName ( BinDir ) , "lib" ) ;
104
106
}
105
107
}
106
108
@@ -179,26 +181,24 @@ static PDictionary CreateDefaultVersionsPlist ()
179
181
180
182
void Init ( )
181
183
{
182
- string currentLocation = IsInstalled ? Path . Combine ( BinDir , "mtouch" ) : null ;
184
+ string currentLocation = IsInstalled ? mtouchPath : null ;
183
185
184
186
IsInstalled = false ;
185
187
versions = null ;
186
188
187
189
if ( string . IsNullOrEmpty ( SdkDir ) ) {
188
190
foreach ( var loc in DefaultLocations ) {
189
- if ( IsInstalled = ValidateSdkLocation ( loc , out hasUsrSubdir ) ) {
191
+ if ( IsInstalled = ValidateSdkLocation ( loc , out mtouchPath ) ) {
190
192
SdkDir = loc ;
191
193
break ;
192
194
}
193
195
}
194
196
} else {
195
- IsInstalled = ValidateSdkLocation ( SdkDir , out hasUsrSubdir ) ;
197
+ IsInstalled = ValidateSdkLocation ( SdkDir , out mtouchPath ) ;
196
198
}
197
199
198
- string mtouch = null ;
199
200
if ( IsInstalled ) {
200
- mtouch = Path . Combine ( BinDir , "mtouch" ) ;
201
- lastMTExeWrite = File . GetLastWriteTimeUtc ( mtouch ) ;
201
+ lastMTExeWrite = File . GetLastWriteTimeUtc ( mtouchPath ) ;
202
202
Version = ReadVersion ( ) ;
203
203
204
204
if ( Version . CompareTo ( requiredXI ) >= 0 ) {
@@ -235,7 +235,7 @@ void Init ()
235
235
AnalyticsService . ReportSdkVersion ( "XS.Core.SDK.iOS.Version" , string . Empty ) ;
236
236
}
237
237
238
- if ( Changed != null && currentLocation != mtouch )
238
+ if ( Changed != null && currentLocation != mtouchPath )
239
239
Changed ( this , EventArgs . Empty ) ;
240
240
}
241
241
@@ -256,23 +256,31 @@ IPhoneSdkVersion ReadVersion ()
256
256
257
257
public static bool ValidateSdkLocation ( string sdkDir )
258
258
{
259
- bool hasUsrSubdir ;
260
-
261
- return ValidateSdkLocation ( sdkDir , out hasUsrSubdir ) ;
259
+ return ValidateSdkLocation ( sdkDir , out string _ ) ;
262
260
}
263
261
264
262
public static bool ValidateSdkLocation ( string sdkDir , out bool hasUsrSubdir )
265
263
{
266
264
hasUsrSubdir = false ;
265
+ return ValidateSdkLocation ( sdkDir , out string _ ) ;
266
+ }
267
+
268
+ public static bool ValidateSdkLocation ( string sdkDir , out string mtouchPath )
269
+ {
270
+ mtouchPath = null ;
267
271
268
272
if ( ! File . Exists ( Path . Combine ( sdkDir , "Version" ) ) )
269
273
return false ;
270
274
271
- if ( File . Exists ( Path . Combine ( sdkDir , "bin" , "mtouch" ) ) )
275
+ var path = Path . Combine ( sdkDir , "bin" , "mtouch" ) ;
276
+ if ( File . Exists ( path ) ) {
277
+ mtouchPath = path ;
272
278
return true ;
279
+ }
273
280
274
- if ( File . Exists ( Path . Combine ( sdkDir , "usr" , "bin" , "mtouch" ) ) ) {
275
- hasUsrSubdir = true ;
281
+ path = Path . Combine ( sdkDir , "tools" , "bin" , "mtouch" ) ;
282
+ if ( File . Exists ( path ) ) {
283
+ mtouchPath = path ;
276
284
return true ;
277
285
}
278
286
@@ -367,7 +375,7 @@ public void CheckCaches ()
367
375
{
368
376
if ( IsInstalled ) {
369
377
try {
370
- var lastWrite = File . GetLastWriteTimeUtc ( Path . Combine ( BinDir , "mtouch" ) ) ;
378
+ var lastWrite = File . GetLastWriteTimeUtc ( mtouchPath ) ;
371
379
if ( lastWrite == lastMTExeWrite )
372
380
return ;
373
381
} catch ( IOException ) {
0 commit comments