From 5b77f3609138171e3001cf2743a409a5685162ee Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Tue, 30 Jul 2019 19:43:23 +0200 Subject: [PATCH] fix(cordova): return proper pathForResource in CDVCommandDelegate (#1826) --- .../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