Browse Source

Change relink script error handling #116

Ben Hsieh 8 years ago
parent
commit
42478bdfeb
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      src/scripts/prelink.js

+ 9
- 2
src/scripts/prelink.js View File

6
 var hasNecessaryFile = fs.existsSync(MANIFEST_PATH) && fs.existsSync(MANIFEST_PATH);
6
 var hasNecessaryFile = fs.existsSync(MANIFEST_PATH) && fs.existsSync(MANIFEST_PATH);
7
 
7
 
8
 if (!hasNecessaryFile) {
8
 if (!hasNecessaryFile) {
9
-  throw 'RNFetchBlob could not found link Android automatically, some files could not be found.'
9
+  console.log('\033[31m*** react-native-fetch-blob pre-link FAILED ***')
10
+  console.log('\033[31mRNFetchBlob could not link Android automatically, some files could not be found.')
11
+  console.log('\033[31mYou may have to manually link the library, see \033[36mhttps://github.com/wkh237/react-native-fetch-blob#manually-link-the-package-android \033[31mfor more information.')
12
+  return
10
 }
13
 }
11
 
14
 
12
 var package = JSON.parse(fs.readFileSync(PACKAGE_JSON));
15
 var package = JSON.parse(fs.readFileSync(PACKAGE_JSON));
20
 if(VERSION >= 0.29) {
23
 if(VERSION >= 0.29) {
21
   console.log('RNFetchBlob patching MainApplication.java .. ');
24
   console.log('RNFetchBlob patching MainApplication.java .. ');
22
   if(!fs.existsSync(APPLICATION_MAIN)) {
25
   if(!fs.existsSync(APPLICATION_MAIN)) {
23
-    throw 'RNFetchBlob could not link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN
26
+    console.log('\033[31m*** react-native-fetch-blob pre-link FAILED ***')
27
+    console.log('\033[31mRNFetchBlob could not link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN)
28
+    console.log('\033[31mRNFetchBlob could not link Android automatically, some files could not be found.')
29
+    console.log('\033[31mTry manually link the library, see \033[36mhttps://github.com/wkh237/react-native-fetch-blob#manually-link-the-package-android \033[31mfor more information.')
30
+    return
24
   }
31
   }
25
   var main = fs.readFileSync(APPLICATION_MAIN);
32
   var main = fs.readFileSync(APPLICATION_MAIN);
26
   if(String(main).match('new RNFetchBlobPackage()') !== null) {
33
   if(String(main).match('new RNFetchBlobPackage()') !== null) {