Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

String comparison is unnecessary if lengths don't match.

  • Loading branch information...
commit 2ca7571ae0603c8b63cee820aea2e9aace7febea 1 parent 70aadff
@mikeabdullah mikeabdullah authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 KSPathUtilities.m
View
8 KSPathUtilities.m
@@ -183,9 +183,13 @@ - (NSString *)ks_pathRelativeToDirectory:(NSString *)dirPath
if (componentRange.length > 0)
{
// Ignore components which just specify current directory
- if ([dirPath compare:@"." options:NSLiteralSearch range:componentRange] != NSOrderedSame)
+ if (componentRange.length > 1 || [dirPath compare:@"." options:NSLiteralSearch range:componentRange] != NSOrderedSame)
{
- NSAssert([dirPath compare:@".." options:NSLiteralSearch range:componentRange] != NSOrderedSame, @".. unsupported");
+ if (componentRange.length == 2)
+ {
+ NSAssert([dirPath compare:@".." options:NSLiteralSearch range:componentRange] != NSOrderedSame, @".. unsupported");
+ }
+
if ([result length]) [result appendString:@"/"];
[result appendString:@".."];
}
Please sign in to comment.
Something went wrong with that request. Please try again.