mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7675 from darkdukey/chore/reuse-file-utils-for-video-path
Chore/reuse file utils for video path
This commit is contained in:
commit
16653bf24e
|
@ -31,6 +31,7 @@ using namespace cocos2d::experimental::ui;
|
|||
#include "CCEAGLView.h"
|
||||
#import <MediaPlayer/MediaPlayer.h>
|
||||
#include "base/CCDirector.h"
|
||||
#include "CCFileUtils.h"
|
||||
|
||||
@interface UIVideoViewWrapperIos : NSObject
|
||||
|
||||
|
@ -259,23 +260,7 @@ using namespace cocos2d::experimental::ui;
|
|||
|
||||
+(NSString*) fullPathFromRelativePath:(NSString*) relPath
|
||||
{
|
||||
// do not convert an absolute path (starting with '/')
|
||||
if(([relPath length] > 0) && ([relPath characterAtIndex:0] == '/'))
|
||||
{
|
||||
return relPath;
|
||||
}
|
||||
|
||||
NSMutableArray *imagePathComponents = [NSMutableArray arrayWithArray:[relPath pathComponents]];
|
||||
NSString *file = [imagePathComponents lastObject];
|
||||
|
||||
[imagePathComponents removeLastObject];
|
||||
NSString *imageDirectory = [NSString pathWithComponents:imagePathComponents];
|
||||
|
||||
NSString *fullpath = [[NSBundle mainBundle] pathForResource:file ofType:nil inDirectory:imageDirectory];
|
||||
if (fullpath == nil)
|
||||
fullpath = relPath;
|
||||
|
||||
return fullpath;
|
||||
return [NSString stringWithCString: cocos2d::FileUtils::getInstance()->fullPathForFilename(std::string([relPath UTF8String])).c_str() encoding: [NSString defaultCStringEncoding]];
|
||||
}
|
||||
@end
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue