Skip to content

Instantly share code, notes, and snippets.

@mogya
Created July 26, 2012 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogya/3182679 to your computer and use it in GitHub Desktop.
Save mogya/3182679 to your computer and use it in GitHub Desktop.
patch for the issue TermiT / ZipFile doesn't work with ti1.7.2 and after.
diff --git Classes/ZipFileModule.m Classes/ZipFileModule.m
index cd85b07..b8b0cff 100644
--- Classes/ZipFileModule.m
+++ Classes/ZipFileModule.m
@@ -84,12 +84,32 @@
//}
}
+/*
+ * Convert file url into absolute path (file://localhost/a/b.png -> /a/b.png)
+ * copyed from
+ * https://github.com/infosia/quicktigame2dmodule/blob/master/QuickTiGame2d/QuickTiGame2d/QuickTiGame2dUtil.m#L75
+ */
+NSString* replaceFileSchemeFromString(NSString* filename) {
+ NSRange schemeRange = [filename rangeOfString:@"://"];
+ if (schemeRange.location != NSNotFound) {
+ filename = [filename substringFromIndex:(schemeRange.location + 3)];
+ schemeRange = [filename rangeOfString:@"/"];
+ if (schemeRange.location != NSNotFound) {
+ filename = [filename substringFromIndex:schemeRange.location];
+ }
+ filename = [filename stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+ }
+ return filename;
+}
+
#pragma Public APIs
-(void)extract:(id)args
{
NSString *file = [args objectAtIndex:0];
NSString *path = [args objectAtIndex:1];
+ file = replaceFileSchemeFromString(file);
+ path = replaceFileSchemeFromString(path);
NSFileManager *fileManager = [NSFileManager defaultManager];
diff --git titanium.xcconfig titanium.xcconfig
index 0f7c3f7..a4f095c 100644
--- titanium.xcconfig
+++ titanium.xcconfig
@@ -4,7 +4,7 @@
// OF YOUR TITANIUM SDK YOU'RE BUILDING FOR
//
//
-TITANIUM_SDK_VERSION = 1.8.1
+TITANIUM_SDK_VERSION = 2.1.0.GA
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment