You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some corner cases in which certain directory structures will not work with CocosBuilder. The problem lies with the relativePathFromAbsolutePath method in ResourceManagerUtil.
Here's an example of a project setup that's broken:
When I set a sprite frame to be a resource in the "Cocosbuilder Raw Assets Android" directory, the relativePathFromAbsolute path returns a bad relative path. The issue lies with "Cocosbuilder Raw Assets Android" having the same prefix as the "Cocosbuilder" directory in which the project file lives.
+ (NSString*) relativePathFromAbsolutePath: (NSString*) path
{
NSArray* activeDirs = [[ResourceManager sharedManager] activeDirectories];
for (RMDirectory* dir in activeDirs)
{
// Old Code//NSString* base = dir.dirPath; // New CodeNSString* base = [NSStringstringWithFormat:@"%@/", dir.dirPath];
if ([path hasPrefix:base])
{
// Old Code//NSString* relPath = [path substringFromIndex:[base length]+1];// New CodeNSString* relPath = [path substringFromIndex:[base length]];
return relPath;
}
}
NSLog(@"WARNING! ResourceManagerUtil: No relative path");
returnNULL;
}
Replacing the two lines indicated seems to fix the issue for me, and works in brief testing. I'm new to Git, so sorry about not having a pull request. I'm also not sure this change won't introduce other bugs or side-effects.
The text was updated successfully, but these errors were encountered:
There are some corner cases in which certain directory structures will not work with CocosBuilder. The problem lies with the relativePathFromAbsolutePath method in ResourceManagerUtil.
Here's an example of a project setup that's broken:
When I set a sprite frame to be a resource in the "Cocosbuilder Raw Assets Android" directory, the relativePathFromAbsolute path returns a bad relative path. The issue lies with "Cocosbuilder Raw Assets Android" having the same prefix as the "Cocosbuilder" directory in which the project file lives.
Replacing the two lines indicated seems to fix the issue for me, and works in brief testing. I'm new to Git, so sorry about not having a pull request. I'm also not sure this change won't introduce other bugs or side-effects.
The text was updated successfully, but these errors were encountered: