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

set_directory doesn't seem to change starting directory (Windows) #22

Closed
zohnannor opened this issue Aug 30, 2021 · 8 comments
Closed

Comments

@zohnannor
Copy link

This code:

FileDialog::new()
        .set_directory(PathBuf::from("C:\\"))
        .pick_folder()

opens my Documents directory for some reason

@PolyMeilex
Copy link
Owner

Does std::env::current_dir() (used like in simple example) work for you?

For me

rfd::FileDialog::new().set_directory("C:\\").pick_folder();

Works as expected in wine, I will check in a Windows VM some time later today

@zohnannor
Copy link
Author

Nope, any path I set as default, opens C:\Users\USER\Documents. I will test this code on another windows machine to check if error only occurs on mine.

@PolyMeilex
Copy link
Owner

In nfd code I noticed this comment:

// Could also call SetDefaultFolder(), but this guarantees defaultPath -- more consistency across API.
    dialog->SetFolder( folder );

rfd uses setDefaut at the moment, I will add the second approach and I will let you know when it's ready for testing

@zohnannor
Copy link
Author

Ok, waiting for an update!

P.S. I've checked the example code on another machine, it works. Apparently the issue is with my main machine; maybe I will try to figure out what leads to this error...

@PolyMeilex
Copy link
Owner

PolyMeilex commented Aug 30, 2021

You can try master branch, I implemented the change in 1696de8

I would appreciate if you could also check for regressions on the machines that it used to work on before my change

@zohnannor
Copy link
Author

It works now on both machines! Newest commit 11c9c95. I think you can release 0.4.4 now :)

@PolyMeilex
Copy link
Owner

Thank you very much for help!

I will release a patch release shortly

@zohnannor
Copy link
Author

Thank you for quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants