Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add TTPathFromCachesResource helper #782

Closed
wants to merge 1 commit into from

2 participants

@diederich

corresponding to TTPathForBundleResource and TTPathForDocumentsResource

@jamesgpearce

Facebook has not maintained or supported Three20 for some time, and we are closing its old and outstanding pull requests.

Many, many thanks for your support of the project. If you have any further questions, please don't hesitate to let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2012
  1. @diederich
This page is out of date. Refresh to see the latest.
View
5 src/Three20Core/Headers/TTGlobalCorePaths.h
@@ -53,3 +53,8 @@ NSString* TTPathForBundleResource(NSString* relativePath);
* @return The documents path concatenated with the given relative path.
*/
NSString* TTPathForDocumentsResource(NSString* relativePath);
+
+/**
+ * @return The caches path concatenated with the given relative path.
+ */
+NSString* TTPathForCachesResource(NSString* relativePath);
View
10 src/Three20Core/Sources/TTGlobalCorePaths.m
@@ -63,3 +63,13 @@ void TTSetDefaultBundle(NSBundle* bundle) {
}
return [documentsPath stringByAppendingPathComponent:relativePath];
}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+NSString* TTPathForCachesResource(NSString* relativePath) {
+ static NSString* cachesPath = nil;
+ if (nil == cachesPath) {
+ NSArray* dirs = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+ cachesPath = [[dirs objectAtIndex:0] retain];
+ }
+ return [cachesPath stringByAppendingPathComponent:relativePath];
+}
Something went wrong with that request. Please try again.