I have made a rust project that, even in a simple hello-world scenario, is unable to display system file dialogs for opening or saving files, but only when running the program via cargo run
from the integrated terminal in VSC.
Running the project in a regular terminal with cargo run
shows the open-file dialogs properly.
Under normal circumstances, the code should open a file-dialog and block the thread until a file has been chosen. When running from VSC, no window is opened and the code resumes as if the command isn’t there at all. When running from a normal terminal, it runs correctly, pausing code execution until the user has selected a file.
Here is an example of the code I’m debugging with:
fn main() {
let test = rfd::FileDialog::new()
.pick_files();
}
I have tried a couple popular rust packages, including rfd and native-dialog.
Details about my environment:
OS: Ubuntu 22.04
rustc: 1.77.2
VSC: 1.88.1
What settings or files can I look into that may help solve this issue? Thanks!