Back

Dart Function cannot open existing folder.

  • 0
  • Functions
Roshan
15 Jan, 2024, 12:27

I am building a Dart function, Where I have to open a CSV file inside a folder timetables the timetables folder is inside the root folder similar to the lib folder. I have added the timetables folder to pubspec.yaml. When I call the main() function without the AppWrite context, I can read the files from the folder when deployed AppWrite throws an

TypeScript
PathNotFoundException: Cannot open file, path = '/timetables/1_bca_a.csv' (OS Error: No such file or directory, errno = 2)

How do I access the files and folder that are not inside the lib folder and are not dart files.

TL;DR
Developers are facing an issue where a Dart function cannot open an existing folder. When the function is called without the AppWrite context, it is able to read files from the folder, but when deployed with AppWrite, a "PathNotFoundException" error occurs. The error message states that the file or directory does not exist. To access files and folders that are not inside the "lib" folder and are not dart files, developers will need to provide the absolute path to the file or folder instead of using a relative path. This can be done by obtaining the root directory of the application and then appending the relative path to it. Once
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more