Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #import <Foundation/Foundation.h> | |
| 12 #include <string.h> | |
| 13 | |
| 14 #include "webrtc/base/checks.h" | |
| 15 #include "webrtc/typedefs.h" | |
| 16 | |
| 17 std::string IOSResourcePath(std::string name, std::string extension) { | |
| 18 // Extract name of file and exclude any added path. | |
| 19 // Example: name: "audio_coding/testfile32kHz" => file_name: "testfile32kHz". | |
| 20 std::size_t pos = name.find_last_of("/"); | |
| 21 DCHECK_NE(pos, std::string::npos); | |
| 22 std::string file_name = name.substr(pos + 1); | |
| 23 // Convert from UTF8 to NSString objects. | |
| 24 NSString* nameString = | |
|
henrika_webrtc
2015/06/11 10:50:31
Could you please comment on the memory handling de
henrika_webrtc
2015/06/11 12:27:56
Perhaps I should do:
[[[NSString alloc] initWithU
henrika_webrtc
2015/06/11 13:10:59
sorry, or perhaps use the factory method stringWit
tkchin_webrtc
2015/06/12 01:30:26
You should enable ARC in GYP file. Use:
henrika_webrtc
2015/06/12 12:52:11
Thanks. Done changes but might have missed some de
tkchin_webrtc
2015/06/12 17:43:35
In this case it doesn't matter. StdStringFromNSStr
henrika_webrtc
2015/06/15 08:46:29
Thanks. Have shifted to using your methods.
| |
| 25 [[NSString alloc] initWithUTF8String:file_name.c_str()]; | |
| 26 NSString* typeString = | |
| 27 [[NSString alloc] initWithUTF8String:extension.c_str()]; | |
| 28 // Get full pathname for the resource identified by the name and extension. | |
| 29 NSString* pathString = [[NSBundle mainBundle] pathForResource: nameString | |
| 30 ofType: typeString]; | |
| 31 // Return a null-terminated UTF8 representation of |pathString|. | |
| 32 return pathString.UTF8String; | |
| 33 } | |
| OLD | NEW |