Entire project directory fails to load when permission denied to a file
Describe the bug
When encountering a file that Phoenix Code does not have permission to read, the entire project fails to load (no files in the file tree, directory does not appear in the project switcher (switcher reads "default project", probably because it's the only other one in the list), Start Project dialog will not open).
Reproduction
- Using a Windows host running a Docker container or a VM running Linux, mount a directory on the host in the VM
- From within the VM, create a symlink in that mounted directory
- Might be sufficient to just change the permissions on any file in the directory so the current user account doesn't have access to it
- Attempt to open the directory as a project in Phoenix Code
Expected behavior
The IDE should simply not show the inaccessible file in the file tree and continue to process everything else per usual.
OS, Browser and Phoenix versions
- Windows 10 x64, desktop PC
- Phoenix Code 3.8.8, 3.9.4 for Windows x64
logs or debug stack trace if any
{
"name": "EACCES",
"code": "EACCES",
"errno": 3,
"message": "Failed to read directory: Permission denied: /tauri/C/path/to/project EACCES: permission denied, stat 'C:\\path\\to\\project\\.env'",
"path": "/tauri/C/path/to/project",
"stack": "Error: Failed to read directory: Permission denied: /tauri/C/path/to/project EACCES: permission denied, stat 'C:\\path\\to\\project\\.env'\n at new n (https://phtauri.localhost/v3.9.4/phoenix/virtualfs.js:1:461316)\n at e4 (https://phtauri.localhost/v3.9.4/phoenix/virtualfs.js:1:481427)\n at https://phtauri.localhost/v3.9.4/phoenix/virtualfs.js:1:486521",
"nodeStack": "Error: EACCES: permission denied, stat 'C:\\path\\to\\project\\.env'\n at async Object.stat (node:internal/fs/promises:1032:18)"
}
Additional context
I typically work on Laravel webapps where .env is a symlink to one of .env.{local,www_dev,www_prod}. This symlink gets created on the host by a Linux VM, and is ultimately inaccessible/unusable by the host (which is fine for me).
I don't have this problem with Brackets 2.2.1; the .env file simply doesn't show up in the file tree, and neither do the variants. I don't know for sure, but I'm thinking that either Brackets recognizes that the file is inaccessible and just ignores it, or it processes the .gitignore file (which contains entries for .env{,.local,.www_dev,.www_prod}) in the project root first, then just ignores them when it starts reading through the directory.
This is preventing me from migrating from Brackets to Phoenix.
Thanks for reporting the issue @nmalinoski . This will be fixed when we address https://github.com/phcode-dev/phoenix/issues/1710 and other file system related issues in the next release or by November release.
Any update on this issue?
I currently have the same issue as the linked issue and it partly makes the editor unusable because working on multiple files just results in constant "Refresh or keep in-editor?" prompts, catching you mid keypress.
@ChristopherKlay is the project in a network location or on a synced cloud drive by any chance? Which os is this btw.
The project is on a synced cloud drive (Google Drive) accessed via editor version 4.0 build 4.0.3-20878 on a Windows 11 Pro device.
We are yet to fix that error. File system related fixes are scheduled for the next 2 releases as there are a few pending.