alpha0010 / react-native-file-access

Filesystem access for React Native
MIT License
307 stars 19 forks source link

Failed to rename file #27

Closed Andarius closed 3 years ago

Andarius commented 3 years ago

Hi,

After downloading a file using react-native-bolb-courier, I'm trying to move it to another location using FileSystem.mv. While this works fine on Android, I get this error on iOS:

Failed to rename 
'file:///var/mobile/Containers/Data/Application/DFE4D5A0-490C-49B7-A6CF-C8AAB56B8D7F/Library/Caches/83.svg' 
to 
'file:///var/mobile/Containers/Data/Application/DFE4D5A0-490C-49B7-A6CF-C8AAB56B8D7F/Library/Caches/test.svg'

Any ideas how why I can't do it on iOS ? Is it a missing configuration / right ?

Thanks !

react-native-file-access: 1.7.0
alpha0010 commented 3 years ago

Looks like you already figured it out; the handler implementation for file:// paths was missing on iOS. Available now in 1.7.1.

Andarius commented 3 years ago

ah nice ! Yeah it was the file://. Thanks for the release !

Andarius commented 3 years ago

@alpha0010, on a side note, can you confirm that mvworks on Android if the destination folder does not exist but will fail on ios ? For instance moving foo.txt to path/bar/baz (which does not exist), will work on Android but fail on iOS (you need to explicitly run mkdir )

alpha0010 commented 3 years ago

Correct; this library does not automatically create destination folders. If a particular command works when the destination folder does not exist, that is operating system defined and should not be relied on.

I am undecided on if this behavior is better (more closely follows OS, does not trigger potentially unneeded checks and unexpected creates). However, automatic folder creation is often more convenient.