From 8ef6842f46e68bd332fe25b57f51ecbda72b68a1 Mon Sep 17 00:00:00 2001 From: Travis Nuttall Date: Sat, 23 Jun 2018 21:39:09 -0600 Subject: [PATCH] stop replacing "/" with "_", but remove leading "./" if found fixes #20 --- android/src/main/java/com/reactlibrary/RNThreadModule.java | 6 +++++- examples/SimpleExample/android/app/build.gradle | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/reactlibrary/RNThreadModule.java b/android/src/main/java/com/reactlibrary/RNThreadModule.java index 5ca8b1b..b8f19eb 100644 --- a/android/src/main/java/com/reactlibrary/RNThreadModule.java +++ b/android/src/main/java/com/reactlibrary/RNThreadModule.java @@ -58,7 +58,11 @@ public class RNThreadModule extends ReactContextBaseJavaModule implements Lifecy public void startThread(final String jsFileName, final Promise promise) { Log.d(TAG, "Starting web thread - " + jsFileName); - String jsFileSlug = jsFileName.contains("/") ? jsFileName.replaceAll("/", "_") : jsFileName; + // When we create the absolute file path later, a "./" will break it. + // Remove the leading "./" if it exists. + String jsFileSlug = jsFileName.contains("./") + ? jsFileName.replace("./", "") + : jsFileName; JSBundleLoader bundleLoader = getDevSupportManager().getDevSupportEnabled() ? createDevBundleLoader(jsFileName, jsFileSlug) diff --git a/examples/SimpleExample/android/app/build.gradle b/examples/SimpleExample/android/app/build.gradle index cd80088..8e0b6b6 100644 --- a/examples/SimpleExample/android/app/build.gradle +++ b/examples/SimpleExample/android/app/build.gradle @@ -148,10 +148,10 @@ android { } dependencies { - compile project(':react-native-threads') compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules + compile project(':react-native-threads') } // Run this once to be able to run the application with BUCK -- 2.26.2