You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Engine/lib/nativeFileDialogs/README.md
+55-25Lines changed: 55 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Native File Dialog #
2
2
3
-
A tiny, neat C library that portably invokes native file open and save dialogs. Write dialog code once and have it pop up native dialogs on all supported platforms. Avoid linking large dependencies like wxWidgets and qt.
3
+
A tiny, neat C library that portably invokes native file open, folder select and save dialogs. Write dialog code once and have it pop up native dialogs on all supported platforms. Avoid linking large dependencies like wxWidgets and qt.
4
4
5
5
Features:
6
6
@@ -11,11 +11,12 @@ Features:
11
11
- Paid support available.
12
12
- Multiple file selection support.
13
13
- 64-bit and 32-bit friendly.
14
-
- GCC, Clang and Visual Studio supported.
15
-
- No third party dependencies.
14
+
- GCC, Clang, Xcode, Mingw and Visual Studio supported.
15
+
- No third party dependencies for building or linking.
16
16
- Support for Vista's modern `IFileDialog` on Windows.
17
17
- Support for non-deprecated Cocoa APIs on OS X.
18
-
- GTK+3 dialog on Linux.
18
+
- GTK3 dialog on Linux.
19
+
- Optional Zenity support on Linux to avoid linking GTK.
19
20
- Tested, works alongside [http://www.libsdl.org](SDL2) on all platforms, for the game developers out there.
20
21
21
22
# Example Usage #
@@ -50,47 +51,74 @@ See [NFD.h](src/include/nfd.h) for more options.
50
51
51
52
# Screenshots #
52
53
53
-

54
+

54
55

55
56

56
57
58
+
## Changelog ##
59
+
60
+
release | what's new | date
61
+
--------|-----------------------------|---------
62
+
1.0.0 | initial | oct 2014
63
+
1.1.0 | premake5; scons deprecated | aug 2016
64
+
1.1.1 | mingw support, build fixes | aug 2016
65
+
1.1.2 | test_pickfolder() added | aug 2016
66
+
1.1.3 | zenity linux backend added | nov 2017
67
+
1.1.3 | fix char type in decls | nov 2017
68
+
1.1.4 | fix win32 memleaks | dec 2018
69
+
1.1.4 | improve win32 errorhandling | dec 2018
70
+
1.1.4 | macos fix focus bug | dec 2018
71
+
57
72
58
73
## Building ##
59
74
60
-
NFD uses [SCons](http://www.scons.org) for cross-platform builds. After installing SCons, build it with:
75
+
NFD uses [Premake5](https://premake.github.io/download.html) generated Makefiles and IDE project files. The generated project files are checked in under `build/` so you don't have to download and use Premake in most cases.
61
76
62
-
cd src
63
-
scons debug=[0,1]
77
+
If you need to run Premake5 directly, further [build documentation](docs/build.md) is available.
64
78
65
-
Alternatively, you can avoid Scons by just including NFD files to your existing project:
79
+
Previously, NFD used SCons to build. It still works, but is now deprecated; updates to it are discouraged. Opt to use the native build system where possible.
66
80
67
-
1. Add all header files in `src/` and `src/include` to your project.
68
-
2. Add `src/include` to your include search path or copy it into your existing search path.
69
-
3. Add `src/nfd_common.c` to your project.
70
-
4. Add `src/nfd_<platform>` to your project, where `<platform>` is the NFD backend for the platform you are fixing to build.
71
-
5. On Visual Studio, define `_CRT_SECURE_NO_WARNINGS` to avoid warnings.
81
+
`nfd.a` will be built for release builds, and `nfd_d.a` will be built for debug builds.
82
+
83
+
### Makefiles ###
84
+
85
+
The makefile offers five options, with `release_x64` as the default.
86
+
87
+
make config=release_x86
88
+
make config=release_x64
89
+
make config=debug_x86
90
+
make config=debug_x64
72
91
73
92
### Compiling Your Programs ###
74
93
75
94
1. Add `src/include` to your include search path.
76
-
2. Add `nfd.lib` to the list of list of static libraries to link against.
77
-
3. Add `src/` to the library search path.
95
+
2. Add `nfd.lib` or `nfd_d.lib` to the list of list of static libraries to link against (for release or debug, respectively).
96
+
3. Add `build/<debug|release>/<arch>` to the library search path.
97
+
98
+
#### Linux GTK ####
99
+
`apt-get libgtk-3-dev` installs the gtk dependency for library compilation.
78
100
79
-
On Linux, you must compile and link against GTK+. Recommend use of `pkg-config --cflags --libs gtk+-3.0`.
101
+
On Linux, you have the option of compiling and linking against GTK. If you use it, the recommended way to compile is to include the arguments of `pkg-config --cflags --libs gtk+-3.0`.
80
102
81
-
On Mac OS X, add `AppKit` to the list of frameworks.
103
+
#### Linux Zenity ####
82
104
105
+
Alternatively, you can use the Zenity backend by running the Makefile in `build/gmake_linux_zenity`. Zenity runs the dialog in its own address space, but requires the user to have Zenity correctly installed and configured on their system.
106
+
107
+
#### MacOS ####
108
+
On Mac OS, add `AppKit` to the list of frameworks.
109
+
110
+
#### Windows ####
83
111
On Windows, ensure you are building against `comctl32.lib`.
84
112
85
113
## Usage ##
86
114
87
115
See `NFD.h` for API calls. See `tests/*.c` for example code.
88
116
89
-
See `tests/SConstruct` for a working build script that compiles on all platforms.
117
+
After compiling, `build/bin` contains compiled test programs.
90
118
91
119
## File Filter Syntax ##
92
120
93
-
There is a form of file filtering in every file dialog, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
121
+
There is a form of file filtering in every file dialog API, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
94
122
95
123
A wildcard filter is always added to every dialog.
96
124
@@ -113,23 +141,25 @@ See [test_opendialogmultiple.c](test/test_opendialogmultiple.c).
113
141
114
142
# Known Limitations #
115
143
116
-
I accept quality code patches, or will resolve these and other matters through support.
144
+
I accept quality code patches, or will resolve these and other matters through support. See [submitting pull requests](docs/submitting_pull_requests.md) for details.
117
145
118
146
- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
119
-
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, though.
120
-
- No support for selecting folders instead of files.
121
-
- On Linux, GTK+ cannot be uninitialized to save memory. Launching a file dialog costs memory. I am open to accepting an alternative `nfd_zenity.c` implementation which uses Zenity and pipes.
147
+
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, however.
0 commit comments