From 7365d0b596deb511da1bf692af6463b50ab79e1e Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 30 Jul 2019 18:54:33 +0200 Subject: [PATCH] fix(cordova): return proper pathForResource in CDVCommandDelegate --- .../Classes/Public/CDVCommandDelegateImpl.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m b/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m index 11e91299e..8b69b0f90 100644 --- a/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +++ b/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m @@ -51,9 +51,14 @@ - (NSString*)pathForResource:(NSString*)resourcepath [directoryParts removeLastObject]; NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"]; + NSString* baseFolder = @"public"; + NSString* directoryStr = baseFolder; + if ([directoryPartsJoined length] > 0) { + directoryStr = [NSString stringWithFormat:@"%@/%@", baseFolder, [directoryParts componentsJoinedByString:@"/"]]; + } - return [mainBundle pathForResource:filename ofType:@"" inDirectory:@"www"]; + return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr]; } - (void)flushCommandQueueWithDelayedJs