From e42d5232769dc516dc4425ddf35f1aa88886f029 Mon Sep 17 00:00:00 2001 From: Travis Nuttall Date: Wed, 3 Oct 2018 14:35:14 -0600 Subject: [PATCH] remove leading directory path from file slug fixes #46 --- android/src/main/java/com/reactlibrary/RNThreadModule.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactlibrary/RNThreadModule.java b/android/src/main/java/com/reactlibrary/RNThreadModule.java index b8f19eb..93fd021 100644 --- a/android/src/main/java/com/reactlibrary/RNThreadModule.java +++ b/android/src/main/java/com/reactlibrary/RNThreadModule.java @@ -169,7 +169,11 @@ public class RNThreadModule extends ReactContextBaseJavaModule implements Lifecy private JSBundleLoader createDevBundleLoader(String jsFileName, String jsFileSlug) { String bundleUrl = bundleUrlForFile(jsFileName); - String bundleOut = getReactApplicationContext().getFilesDir().getAbsolutePath() + "/" + jsFileSlug; + // nested file directory will not exist in the files dir during development, + // so remove any leading directory paths to simply download a flat file into + // the root of the files directory. + String[] splitFileSlug = jsFileSlug.split("/"); + String bundleOut = getReactApplicationContext().getFilesDir().getAbsolutePath() + "/" + splitFileSlug[splitFileSlug.length - 1]; Log.d(TAG, "createDevBundleLoader - download web thread to - " + bundleOut); downloadScriptToFileSync(bundleUrl, bundleOut); -- 2.26.2