Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: experimental/iOSSampleApp/Shared/skia_ios.mm

Issue 1054073003: Minimal Changes to run tests on iOS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/iOSSampleApp/Shared/skia_ios.mm
diff --git a/experimental/iOSSampleApp/Shared/skia_ios.mm b/experimental/iOSSampleApp/Shared/skia_ios.mm
index 45675fa61a0b4ef817997c899b682c32f2443784..b8680c40e9c0f0ea5f53b5092c779bb33b3d28f4 100644
--- a/experimental/iOSSampleApp/Shared/skia_ios.mm
+++ b/experimental/iOSSampleApp/Shared/skia_ios.mm
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#import <UIKit/UIKit.h>
#include "SkApplication.h"
@@ -5,14 +11,24 @@ int main(int argc, char *argv[]) {
signal(SIGPIPE, SIG_IGN);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
application_init();
+
// Identify the documents directory
NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsDir = [dirPaths objectAtIndex:0];
- const char *d = [docsDir UTF8String];
- IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
- int retVal = launchType == kApplication__iOSLaunchType
- ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType;
+ NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"];
+ const char *d = [resourceDir UTF8String];
+
+ // change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
+ NSFileManager *filemgr = [NSFileManager defaultManager];
+ int retVal = 99;
+ if ([filemgr changeCurrentDirectoryPath: docsDir] == YES)
+ {
+ IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
+ retVal = launchType == kApplication__iOSLaunchType
+ ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType;
+ }
application_term();
+ [filemgr release];
[pool release];
return retVal;
}
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698