diff --git a/package-lock.json b/package-lock.json index f116e74de..0dc5e2bdd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23993,16 +23993,6 @@ } } }, - "node_modules/react-native-file-access": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/react-native-file-access/-/react-native-file-access-3.1.0.tgz", - "integrity": "sha512-wOpfKpJ8s4Csfjcvf7H4L1EtmejM07HQpndzMRWAianLC50EsPc78iV8TQaw5yI7j18rh9fWMqpevz8f5a1rsA==", - "dev": true, - "peerDependencies": { - "react": "*", - "react-native": "*" - } - }, "node_modules/react-native-navigation": { "version": "7.37.2", "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.37.2.tgz", @@ -28581,14 +28571,12 @@ "devDependencies": { "@react-native-community/netinfo": "^9.4.1", "@types/react": "^18.2.24", - "metro-react-native-babel-preset": "^0.77.0", - "react-native-file-access": ">=1.7.1 <4.0.0" + "metro-react-native-babel-preset": "^0.77.0" }, "peerDependencies": { "@react-native-community/netinfo": ">= 9.4.1", "react": "*", - "react-native": "*", - "react-native-file-access": ">=1.7.1 <4.0.0" + "react-native": "*" } }, "packages/plugin-react-native-navigation": { diff --git a/packages/platforms/react-native/android/src/main/java/com/bugsnag/android/performance/NativeBugsnagPerformanceImpl.java b/packages/platforms/react-native/android/src/main/java/com/bugsnag/android/performance/NativeBugsnagPerformanceImpl.java index 2c89f5b16..fd2713e9e 100644 --- a/packages/platforms/react-native/android/src/main/java/com/bugsnag/android/performance/NativeBugsnagPerformanceImpl.java +++ b/packages/platforms/react-native/android/src/main/java/com/bugsnag/android/performance/NativeBugsnagPerformanceImpl.java @@ -94,8 +94,6 @@ void exists(String path, Promise promise) { boolean result = new File(path).exists(); if (result) { promise.resolve(result); - } else { - promise.reject(new Exception("File does not exist")); } } catch(Exception e) { promise.reject(e); @@ -107,8 +105,6 @@ void isDir(String path, Promise promise) { boolean result = new File(path).isDirectory(); if (result) { promise.resolve(result); - } else { - promise.reject(new Exception("Path is not a directory")); } } catch(Exception e) { promise.reject(e); @@ -117,7 +113,13 @@ void isDir(String path, Promise promise) { void ls(String path, Promise promise) { try { - promise.resolve(new File(path).list()); + String[] files = new File(path).list(); + WritableArray resultArray = Arguments.createArray(); + for (String file : files) { + resultArray.pushString(file); + } + + promise.resolve(resultArray); } catch(Exception e) { promise.reject(e); } @@ -125,7 +127,13 @@ void ls(String path, Promise promise) { void mkdir(String path, Promise promise) { try { - boolean result = new File(path).mkdir(); + File file = new File(path); + if (file.exists()) { + promise.reject("EEXIST", new Exception("Already exists.")); + return; + } + + boolean result = file.mkdirs(); if (result) { promise.resolve(path); } else {