From 19837781198c21fb245d970d387bc387fe502293 Mon Sep 17 00:00:00 2001 From: Adam Segal Date: Tue, 10 Sep 2024 20:36:48 -0700 Subject: [PATCH] Fix bug with getWorkletsLibraryPath --- package/VisionCamera.podspec | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/package/VisionCamera.podspec b/package/VisionCamera.podspec index 5d611cf18a..03f429165e 100644 --- a/package/VisionCamera.podspec +++ b/package/VisionCamera.podspec @@ -22,12 +22,17 @@ else end def Pod::getWorkletsLibraryPath - output = `cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "try { require.resolve('react-native-worklets-core/package.json') } catch(e) { /* returning undefined, if package not found */ }"` + installation_root = Pod::Config.instance.installation_root.to_s + command = "cd \"#{installation_root}\" && node --print \"try { console.log(require.resolve('react-native-worklets-core/package.json')) } catch(e) { console.log('PACKAGE_NOT_FOUND') }\"" - if output.strip == "undefined" + output = `#{command}` + lines = output.split("\n").map(&:strip) + + if lines.include?('PACKAGE_NOT_FOUND') return nil else - return File.dirname(output) + package_line = lines.find { |line| line.include?('react-native-worklets-core/package.json') } + return package_line ? File.dirname(package_line) : nil end end