Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathNotFoundException: PathNotFoundException: Cannot open file, path = '/var/mobile/Containers/Data/Application/4639D148... #4725

Closed
sentry-io bot opened this issue Oct 25, 2023 · 1 comment · Fixed by #4772
Assignees
Labels
background tasks 🐛 bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Oct 25, 2023

Sentry Issue: SMOOTHIE-2BF

Background task error (PathNotFoundException: Cannot open file, path = '/var/mobile/Containers/Data/Application/4639D148-C579-4CC4-9A11-267614A0DDE4/Library/Application Support/full_image_4.jpeg' (OS Error: No such file or directory, errno = 2))
debug
10:01:47
default
New permission value: DevicePermission{permission: Permission.camera, status: DevicePermissionStatus.granted}

@sentry-io sentry-io bot added the ⭐ top issue Top issue. label Oct 25, 2023
@github-actions github-actions bot removed the ⭐ top issue Top issue. label Oct 25, 2023
@teolemon teolemon added 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… 🐛 bug Something isn't working labels Oct 25, 2023
@monsieurtanuki monsieurtanuki self-assigned this Nov 8, 2023
@monsieurtanuki
Copy link
Contributor

monsieurtanuki commented Nov 8, 2023

Looks like it's an error specific to ios.
We're using the "Application Support" directory that does not seem to be clearer automatically (e.g. when space is needed).

BUT

Since iOS 8.0, every time you rebuild your code, the name of the application folder (which contains your documents and library directories) changes. This is the intended behaviour.
So if you want to store a path, you should only store the filename, and then combine it with the location of the documents directory on the fly. This way, it will always point to the correct location.

And indeed we're storing the full path in the background tasks (e.g. '/var/mobile/Containers/Data/Application/23AE7B1D-8B8C-4F4D-BD35-E1A8CC463589/Library/Application Support/full_image_4.jpeg').
The solution, specific to ios, would be to retry with the same filename but with the latest generation of the folder.

I can code that, I just cannot test it on actual ios devices.

(for the record, on android the same path is something like '/data/data/org.openfoodfacts.scanner/files/full_image_1.jpeg.cropped.jpg')

@monsieurtanuki monsieurtanuki added background tasks and removed 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… labels Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
background tasks 🐛 bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants