Comments (3)
Just to be sure I'm understanding you correctly, you want to have a check at runtime to decide whether to open a Portal or GTK dialog?
from nativefiledialog-extended.
Yes. Sorry, re-reading myself, I realize that this was pretty badly written
The functions could be implemented on your side with something like this:
(pseudocode, I know your API isn't exactly like that)
nfdresult_t NFD::openFile(NFD::UniquePathU8 outPath) {
result = NFD::Portal::openFile(outPath)
if (result == NFD_ERROR) {
return NFD::GTK::openFile(outPath)
} else return result;
}
But It'd also be fine for me if NFD::Portal::openFile()
and NFD::GTK::openFile()
were simply exposed to us, and we had the responsibility to implement the fallback (right now we have to choose between them at compile time with NFD_PORTAL
)
from nativefiledialog-extended.
Thanks for the clarification.
It's a nice feature to have, and I'd be happy to accept a PR for such a feature (as long as it is possible at build time to select just a single implementation).
There's a different but related question, about whether it should be a hard loader error if the loader cannot find libdbus or libgtk at runtime. Your current proposal will be a hard error at load time, which I'm not sure is ideal. Preventing a hard loader error is usually achieved using dlopen() (as mentioned in mlabbe/nativefiledialog#42 and mlabbe/nativefiledialog#102), but it can probably be done more nicely on Linux by importing the functions from shared libraries as weak symbols (with #pragma weak
or some attribute). This will allow you to run your binary even if one of libdbus or libgtk is missing. I'm not too sure whether such a distribution exists in practice though.
from nativefiledialog-extended.
Related Issues (20)
- Use GitHub Actions to let contributors open PRs for wiki pages HOT 2
- How does this project work? HOT 8
- Consider documentation website? HOT 2
- [PR for wiki] Add overview comments & move bindings to readme HOT 1
- Consider comparison of other native file dialog libraries? HOT 2
- WebAssembly (emscripten) support HOT 3
- Setting up Xcode search path for nfd.hpp HOT 5
- Universal Bindings HOT 3
- Doxygen HOT 6
- Arm64 Support HOT 10
- CI bug? HOT 2
- I made a C# binding HOT 32
- Don't use nullptr in fileOpenDialog->Show HOT 3
- OpenDialog with portal backend allows folders to be picked HOT 1
- Standalone Library build instructions always build Debug version HOT 1
- How to use NFD_OpenDialog(, , , default_path) HOT 3
- Not able to import file with non-ASCII characters in the path on Windows HOT 3
- PickFolder on Portal backend should support default path too HOT 1
- How to set the dialog title? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativefiledialog-extended.