filedialog 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/gempush.yml +31 -0
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +30 -0
- data/LICENSE +674 -0
- data/README.md +22 -0
- data/Rakefile +35 -0
- data/bin/console +25 -0
- data/deps/filedialogbuilddeps.rb +49 -0
- data/deps/nativefiledialog/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- data/deps/nativefiledialog/.gitignore +181 -0
- data/deps/nativefiledialog/LICENSE +16 -0
- data/deps/nativefiledialog/README.md +180 -0
- data/deps/nativefiledialog/build/dont_run_premake.txt +1 -0
- data/deps/nativefiledialog/build/gmake_linux/Makefile +101 -0
- data/deps/nativefiledialog/build/gmake_linux/nfd.make +192 -0
- data/deps/nativefiledialog/build/gmake_linux/test_opendialog.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux/test_opendialogmultiple.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux/test_pickfolder.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux/test_savedialog.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/Makefile +101 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/nfd.make +192 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/test_opendialog.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/test_opendialogmultiple.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/test_pickfolder.make +188 -0
- data/deps/nativefiledialog/build/gmake_linux_zenity/test_savedialog.make +188 -0
- data/deps/nativefiledialog/build/gmake_macosx/Makefile +85 -0
- data/deps/nativefiledialog/build/gmake_macosx/nfd.make +154 -0
- data/deps/nativefiledialog/build/gmake_macosx/test_opendialog.make +150 -0
- data/deps/nativefiledialog/build/gmake_macosx/test_opendialogmultiple.make +150 -0
- data/deps/nativefiledialog/build/gmake_macosx/test_pickfolder.make +150 -0
- data/deps/nativefiledialog/build/gmake_macosx/test_savedialog.make +150 -0
- data/deps/nativefiledialog/build/gmake_windows/Makefile +101 -0
- data/deps/nativefiledialog/build/gmake_windows/nfd.make +192 -0
- data/deps/nativefiledialog/build/gmake_windows/test_opendialog.make +188 -0
- data/deps/nativefiledialog/build/gmake_windows/test_opendialogmultiple.make +188 -0
- data/deps/nativefiledialog/build/gmake_windows/test_pickfolder.make +188 -0
- data/deps/nativefiledialog/build/gmake_windows/test_savedialog.make +188 -0
- data/deps/nativefiledialog/build/premake5.lua +265 -0
- data/deps/nativefiledialog/build/vs2010/NativeFileDialog.sln +78 -0
- data/deps/nativefiledialog/build/vs2010/nfd.vcxproj +168 -0
- data/deps/nativefiledialog/build/vs2010/nfd.vcxproj.filters +20 -0
- data/deps/nativefiledialog/build/vs2010/test_opendialog.vcxproj +182 -0
- data/deps/nativefiledialog/build/vs2010/test_opendialogmultiple.vcxproj +182 -0
- data/deps/nativefiledialog/build/vs2010/test_pickfolder.vcxproj +182 -0
- data/deps/nativefiledialog/build/vs2010/test_savedialog.vcxproj +182 -0
- data/deps/nativefiledialog/build/xcode4/NativeFileDialog.xcworkspace/contents.xcworkspacedata +19 -0
- data/deps/nativefiledialog/build/xcode4/nfd.xcodeproj/project.pbxproj +228 -0
- data/deps/nativefiledialog/build/xcode4/test_opendialog.xcodeproj/project.pbxproj +294 -0
- data/deps/nativefiledialog/build/xcode4/test_opendialogmultiple.xcodeproj/project.pbxproj +294 -0
- data/deps/nativefiledialog/build/xcode4/test_pickfolder.xcodeproj/project.pbxproj +294 -0
- data/deps/nativefiledialog/build/xcode4/test_savedialog.xcodeproj/project.pbxproj +294 -0
- data/deps/nativefiledialog/docs/build.md +39 -0
- data/deps/nativefiledialog/docs/contributing.md +25 -0
- data/deps/nativefiledialog/screens/open_cocoa.png +0 -0
- data/deps/nativefiledialog/screens/open_gtk3.png +0 -0
- data/deps/nativefiledialog/screens/open_win.png +0 -0
- data/deps/nativefiledialog/src/common.h +21 -0
- data/deps/nativefiledialog/src/include/nfd.h +74 -0
- data/deps/nativefiledialog/src/nfd_cocoa.m +286 -0
- data/deps/nativefiledialog/src/nfd_common.c +142 -0
- data/deps/nativefiledialog/src/nfd_common.h +39 -0
- data/deps/nativefiledialog/src/nfd_gtk.c +379 -0
- data/deps/nativefiledialog/src/nfd_win.cpp +762 -0
- data/deps/nativefiledialog/src/nfd_zenity.c +307 -0
- data/deps/nativefiledialog/src/simple_exec.h +218 -0
- data/deps/nativefiledialog/test/test_opendialog.c +29 -0
- data/deps/nativefiledialog/test/test_opendialogmultiple.c +32 -0
- data/deps/nativefiledialog/test/test_pickfolder.c +29 -0
- data/deps/nativefiledialog/test/test_savedialog.c +28 -0
- data/ext/filedialog/extconf.rb +58 -0
- data/ext/filedialog/filedialog.c +118 -0
- data/filedialog.gemspec +48 -0
- data/lib/filedialog.rb +50 -0
- data/lib/filedialog/version.rb +5 -0
- metadata +137 -0
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# ruby-filedialog
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/filedialog.svg)](https://badge.fury.io/rb/filedialog)
|
4
|
+
|
5
|
+
A ruby wrapper for https://github.com/mlabbe/nativefiledialog
|
6
|
+
|
7
|
+
## Licensing
|
8
|
+
|
9
|
+
Copyright (C) 2020 Alex Gittemeier
|
10
|
+
|
11
|
+
This program is free software: you can redistribute it and/or modify
|
12
|
+
it under the terms of the GNU General Public License as published by
|
13
|
+
the Free Software Foundation, either version 3 of the License, or
|
14
|
+
(at your option) any later version.
|
15
|
+
|
16
|
+
This program is distributed in the hope that it will be useful,
|
17
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
GNU General Public License for more details.
|
20
|
+
|
21
|
+
You should have received a copy of the GNU General Public License
|
22
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (C) 2020 Alex Gittemeier
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require "bundler/gem_tasks"
|
19
|
+
require "rake/extensiontask"
|
20
|
+
require_relative "deps/filedialogbuilddeps"
|
21
|
+
|
22
|
+
Rake::ExtensionTask.new "filedialog" do |ext|
|
23
|
+
ext.lib_dir = "lib/filedialog"
|
24
|
+
end
|
25
|
+
|
26
|
+
task :compiledeps do
|
27
|
+
FileDialog::BuildDeps.compile_deps
|
28
|
+
end
|
29
|
+
|
30
|
+
task :cleandeps do
|
31
|
+
FileDialog::BuildDeps.clean_deps
|
32
|
+
end
|
33
|
+
|
34
|
+
Rake::Task["compile"].enhance([:compiledeps])
|
35
|
+
Rake::Task["clean"].enhance([:cleandeps])
|
data/bin/console
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Provides a pry console, automatically loading the filedialog library
|
5
|
+
# Copyright (C) 2020 Alex Gittemeier
|
6
|
+
#
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require "bundler/setup"
|
21
|
+
require "pry"
|
22
|
+
|
23
|
+
require "filedialog"
|
24
|
+
|
25
|
+
Pry.start
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (C) 2020 Alex Gittemeier
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require "os"
|
19
|
+
|
20
|
+
module FileDialog
|
21
|
+
module BuildDeps
|
22
|
+
NFD_BUILD_LOCATIONS = {
|
23
|
+
linux: "build/gmake_linux",
|
24
|
+
macos: "build/gmake_macosx",
|
25
|
+
windows: "build/gmake_windows"
|
26
|
+
}.freeze
|
27
|
+
|
28
|
+
PLATFORM =
|
29
|
+
if OS.linux? then :linux
|
30
|
+
elsif OS.mac? then :macos
|
31
|
+
elsif OS.windows? then :windows
|
32
|
+
else :other
|
33
|
+
end
|
34
|
+
|
35
|
+
NFD_BUILDDIR = File.join("nativefiledialog", NFD_BUILD_LOCATIONS[PLATFORM])
|
36
|
+
|
37
|
+
def self.compile_deps
|
38
|
+
Dir.chdir(File.join(__dir__, NFD_BUILDDIR)) do
|
39
|
+
system("make -w")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.clean_deps
|
44
|
+
Dir.chdir(File.join(__dir__, NFD_BUILDDIR)) do
|
45
|
+
system("make -w clean")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Compilation Environment**
|
11
|
+
|
12
|
+
- OS (eg: OSX 10.14, Ubuntu 18.04):
|
13
|
+
- Compiler (eg: GCC, Clang):
|
14
|
+
- Compiler Version (eg: MSVC 2017):
|
15
|
+
- Build directory used (eg: `build/gmake_linux`:
|
16
|
+
- Have I attempted to reproduce the problem on the `devel` branch?
|
17
|
+
|
18
|
+
**Describe the bug**
|
19
|
+
|
20
|
+
_A clear and concise description of what the bug is._
|
21
|
+
|
22
|
+
**Compilation output**
|
23
|
+
|
24
|
+
_If compiling with a makefile, paste the output of `make verbose=1` which includes Makefile steps._
|
25
|
+
|
26
|
+
**Additional context**
|
27
|
+
|
28
|
+
_Add any other context about the problem here._
|
29
|
+
|
30
|
+
**User Description**
|
31
|
+
|
32
|
+
_Are you using NFD as an individual, a small company (less than ten employees) or a larger organization?
|
@@ -0,0 +1,181 @@
|
|
1
|
+
.sconsign.dblite
|
2
|
+
# Object files
|
3
|
+
*.o
|
4
|
+
*.ko
|
5
|
+
*.obj
|
6
|
+
*.elf
|
7
|
+
# Precompiled Headers
|
8
|
+
*.gch
|
9
|
+
*.pch
|
10
|
+
# Libraries
|
11
|
+
*.lib
|
12
|
+
*.a
|
13
|
+
*.la
|
14
|
+
*.lo
|
15
|
+
# Shared objects (inc. Windows DLLs)
|
16
|
+
*.dll
|
17
|
+
*.so
|
18
|
+
*.so.*
|
19
|
+
*.dylib
|
20
|
+
# Executables
|
21
|
+
*.exe
|
22
|
+
*.out
|
23
|
+
*.app
|
24
|
+
*.i*86
|
25
|
+
*.x86_64
|
26
|
+
*.hex
|
27
|
+
|
28
|
+
## Ignore Visual Studio temporary files, build results, and
|
29
|
+
## files generated by popular Visual Studio add-ons.
|
30
|
+
# User-specific files
|
31
|
+
*.suo
|
32
|
+
*.user
|
33
|
+
*.userosscache
|
34
|
+
*.sln.docstates
|
35
|
+
# User-specific folders
|
36
|
+
*.sln.ide/
|
37
|
+
# Build results
|
38
|
+
[Dd]ebug/
|
39
|
+
[Dd]ebugPublic/
|
40
|
+
[Rr]elease/
|
41
|
+
[Rr]eleases/
|
42
|
+
x64/
|
43
|
+
x86/
|
44
|
+
bld/
|
45
|
+
[Bb]in/
|
46
|
+
[Oo]bj/
|
47
|
+
# Roslyn cache directories
|
48
|
+
*.ide/
|
49
|
+
# MSTest test Results
|
50
|
+
[Tt]est[Rr]esult*/
|
51
|
+
[Bb]uild[Ll]og.*
|
52
|
+
#NUNIT
|
53
|
+
*.VisualState.xml
|
54
|
+
TestResult.xml
|
55
|
+
# Build Results of an ATL Project
|
56
|
+
[Dd]ebugPS/
|
57
|
+
[Rr]eleasePS/
|
58
|
+
dlldata.c
|
59
|
+
*_i.c
|
60
|
+
*_p.c
|
61
|
+
*_i.h
|
62
|
+
*.ilk
|
63
|
+
*.meta
|
64
|
+
*.obj
|
65
|
+
*.pch
|
66
|
+
*.pdb
|
67
|
+
*.pgc
|
68
|
+
*.pgd
|
69
|
+
*.rsp
|
70
|
+
*.sbr
|
71
|
+
*.tlb
|
72
|
+
*.tli
|
73
|
+
*.tlh
|
74
|
+
*.tmp
|
75
|
+
*.tmp_proj
|
76
|
+
*.log
|
77
|
+
*.vspscc
|
78
|
+
*.vssscc
|
79
|
+
.builds
|
80
|
+
*.pidb
|
81
|
+
*.svclog
|
82
|
+
*.scc
|
83
|
+
# Chutzpah Test files
|
84
|
+
_Chutzpah*
|
85
|
+
# Visual C++ cache files
|
86
|
+
ipch/
|
87
|
+
*.aps
|
88
|
+
*.ncb
|
89
|
+
*.opensdf
|
90
|
+
*.sdf
|
91
|
+
*.cachefile
|
92
|
+
# Visual Studio profiler
|
93
|
+
*.psess
|
94
|
+
*.vsp
|
95
|
+
*.vspx
|
96
|
+
# TFS 2012 Local Workspace
|
97
|
+
$tf/
|
98
|
+
# Guidance Automation Toolkit
|
99
|
+
*.gpState
|
100
|
+
# ReSharper is a .NET coding add-in
|
101
|
+
_ReSharper*/
|
102
|
+
*.[Rr]e[Ss]harper
|
103
|
+
*.DotSettings.user
|
104
|
+
# JustCode is a .NET coding addin-in
|
105
|
+
.JustCode
|
106
|
+
# TeamCity is a build add-in
|
107
|
+
_TeamCity*
|
108
|
+
# DotCover is a Code Coverage Tool
|
109
|
+
*.dotCover
|
110
|
+
# NCrunch
|
111
|
+
_NCrunch_*
|
112
|
+
.*crunch*.local.xml
|
113
|
+
# MightyMoose
|
114
|
+
*.mm.*
|
115
|
+
AutoTest.Net/
|
116
|
+
# Web workbench (sass)
|
117
|
+
.sass-cache/
|
118
|
+
# Installshield output folder
|
119
|
+
[Ee]xpress/
|
120
|
+
# DocProject is a documentation generator add-in
|
121
|
+
DocProject/buildhelp/
|
122
|
+
DocProject/Help/*.HxT
|
123
|
+
DocProject/Help/*.HxC
|
124
|
+
DocProject/Help/*.hhc
|
125
|
+
DocProject/Help/*.hhk
|
126
|
+
DocProject/Help/*.hhp
|
127
|
+
DocProject/Help/Html2
|
128
|
+
DocProject/Help/html
|
129
|
+
# Click-Once directory
|
130
|
+
publish/
|
131
|
+
# Publish Web Output
|
132
|
+
*.[Pp]ublish.xml
|
133
|
+
*.azurePubxml
|
134
|
+
# TODO: Comment the next line if you want to checkin your web deploy settings
|
135
|
+
# but database connection strings (with potential passwords) will be unencrypted
|
136
|
+
*.pubxml
|
137
|
+
*.publishproj
|
138
|
+
# NuGet Packages
|
139
|
+
*.nupkg
|
140
|
+
# The packages folder can be ignored because of Package Restore
|
141
|
+
**/packages/*
|
142
|
+
# except build/, which is used as an MSBuild target.
|
143
|
+
!**/packages/build/
|
144
|
+
# If using the old MSBuild-Integrated Package Restore, uncomment this:
|
145
|
+
#!**/packages/repositories.config
|
146
|
+
# Windows Azure Build Output
|
147
|
+
csx/
|
148
|
+
*.build.csdef
|
149
|
+
# Windows Store app package directory
|
150
|
+
AppPackages/
|
151
|
+
# Others
|
152
|
+
sql/
|
153
|
+
*.Cache
|
154
|
+
ClientBin/
|
155
|
+
[Ss]tyle[Cc]op.*
|
156
|
+
~$*
|
157
|
+
*~
|
158
|
+
*.dbmdl
|
159
|
+
*.dbproj.schemaview
|
160
|
+
*.pfx
|
161
|
+
*.publishsettings
|
162
|
+
node_modules/
|
163
|
+
bower_components/
|
164
|
+
# RIA/Silverlight projects
|
165
|
+
Generated_Code/
|
166
|
+
# Backup & report files from converting an old project file
|
167
|
+
# to a newer Visual Studio version. Backup files are not needed,
|
168
|
+
# because we have git ;-)
|
169
|
+
_UpgradeReport_Files/
|
170
|
+
Backup*/
|
171
|
+
UpgradeLog*.XML
|
172
|
+
UpgradeLog*.htm
|
173
|
+
# SQL Server files
|
174
|
+
*.mdf
|
175
|
+
*.ldf
|
176
|
+
# Business Intelligence projects
|
177
|
+
*.rdl.data
|
178
|
+
*.bim.layout
|
179
|
+
*.bim_*.settings
|
180
|
+
# Microsoft Fakes
|
181
|
+
FakesAssemblies/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
This software is provided 'as-is', without any express or implied
|
2
|
+
warranty. In no event will the authors be held liable for any damages
|
3
|
+
arising from the use of this software.
|
4
|
+
|
5
|
+
Permission is granted to anyone to use this software for any purpose,
|
6
|
+
including commercial applications, and to alter it and redistribute it
|
7
|
+
freely, subject to the following restrictions:
|
8
|
+
|
9
|
+
1. The origin of this software must not be misrepresented; you must not
|
10
|
+
claim that you wrote the original software. If you use this software
|
11
|
+
in a product, an acknowledgment in the product documentation would be
|
12
|
+
appreciated but is not required.
|
13
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
14
|
+
misrepresented as being the original software.
|
15
|
+
3. This notice may not be removed or altered from any source distribution.
|
16
|
+
|
@@ -0,0 +1,180 @@
|
|
1
|
+
# Native File Dialog #
|
2
|
+
|
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
|
+
|
5
|
+
Features:
|
6
|
+
|
7
|
+
- Lean C API, static library -- no ObjC, no C++, no STL.
|
8
|
+
- Zlib licensed.
|
9
|
+
- Consistent UTF-8 support on all platforms.
|
10
|
+
- Simple universal file filter syntax.
|
11
|
+
- Paid support available.
|
12
|
+
- Multiple file selection support.
|
13
|
+
- 64-bit and 32-bit friendly.
|
14
|
+
- GCC, Clang, Xcode, Mingw and Visual Studio supported.
|
15
|
+
- No third party dependencies for building or linking.
|
16
|
+
- Support for Vista's modern `IFileDialog` on Windows.
|
17
|
+
- Support for non-deprecated Cocoa APIs on OS X.
|
18
|
+
- GTK3 dialog on Linux.
|
19
|
+
- Optional Zenity support on Linux to avoid linking GTK.
|
20
|
+
- Tested, works alongside [http://www.libsdl.org](SDL2) on all platforms, for the game developers out there.
|
21
|
+
|
22
|
+
# Example Usage #
|
23
|
+
|
24
|
+
```C
|
25
|
+
#include <nfd.h>
|
26
|
+
#include <stdio.h>
|
27
|
+
#include <stdlib.h>
|
28
|
+
|
29
|
+
int main( void )
|
30
|
+
{
|
31
|
+
nfdchar_t *outPath = NULL;
|
32
|
+
nfdresult_t result = NFD_OpenDialog( NULL, NULL, &outPath );
|
33
|
+
|
34
|
+
if ( result == NFD_OKAY ) {
|
35
|
+
puts("Success!");
|
36
|
+
puts(outPath);
|
37
|
+
free(outPath);
|
38
|
+
}
|
39
|
+
else if ( result == NFD_CANCEL ) {
|
40
|
+
puts("User pressed cancel.");
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
printf("Error: %s\n", NFD_GetError() );
|
44
|
+
}
|
45
|
+
|
46
|
+
return 0;
|
47
|
+
}
|
48
|
+
```
|
49
|
+
|
50
|
+
See self-documenting API [NFD.h](src/include/nfd.h) for more options.
|
51
|
+
|
52
|
+
# Screenshots #
|
53
|
+
|
54
|
+
![Windows rendering a dialog](screens/open_win.png?raw=true)
|
55
|
+
![GTK3 on Linux rendering a dialog](screens/open_gtk3.png?raw=true)
|
56
|
+
![Cocoa on MacOS rendering a dialog](screens/open_cocoa.png?raw=true)
|
57
|
+
|
58
|
+
## Changelog ##
|
59
|
+
|
60
|
+
- **Major** version increments denote API or ABI departure.
|
61
|
+
- **Minor** version increments denote build or trivial departures.
|
62
|
+
- **Micro** version increments just recompile and drop-in.
|
63
|
+
|
64
|
+
release | what's new | date
|
65
|
+
--------|-----------------------------|---------
|
66
|
+
1.0.0 | initial | oct 2014
|
67
|
+
1.1.0 | premake5; scons deprecated | aug 2016
|
68
|
+
1.1.1 | mingw support, build fixes | aug 2016
|
69
|
+
1.1.2 | test_pickfolder() added | aug 2016
|
70
|
+
1.1.3 | zenity linux backend added | nov 2017
|
71
|
+
<i></i> | fix char type in decls | nov 2017
|
72
|
+
1.1.4 | fix win32 memleaks | dec 2018
|
73
|
+
<i></i> | improve win32 errorhandling | dec 2018
|
74
|
+
<i></i> | macos fix focus bug | dec 2018
|
75
|
+
1.1.5 | win32 fix com reinitialize | aug 2019
|
76
|
+
1.1.6 | fix osx filter bug | aug 2019
|
77
|
+
<i></i> | remove deprecated scons | aug 2019
|
78
|
+
<i></i> | fix mingw compilation | aug 2019
|
79
|
+
<i></i> | -Wextra warning cleanup | aug 2019
|
80
|
+
|
81
|
+
## Building ##
|
82
|
+
|
83
|
+
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.
|
84
|
+
|
85
|
+
If you need to run Premake5 directly, further [build documentation](docs/build.md) is available.
|
86
|
+
|
87
|
+
Previously, NFD used SCons to build. As of 1.1.6, SCons support has been removed entirely.
|
88
|
+
|
89
|
+
`nfd.a` will be built for release builds, and `nfd_d.a` will be built for debug builds.
|
90
|
+
|
91
|
+
### Makefiles ###
|
92
|
+
|
93
|
+
The makefile offers up to four options, with `release_x64` as the default.
|
94
|
+
|
95
|
+
make config=release_x86
|
96
|
+
make config=release_x64
|
97
|
+
make config=debug_x86
|
98
|
+
make config=debug_x64
|
99
|
+
|
100
|
+
### Compiling Your Programs ###
|
101
|
+
|
102
|
+
1. Add `src/include` to your include search path.
|
103
|
+
2. Add `nfd.lib` or `nfd_d.lib` to the list of list of static libraries to link against (for release or debug, respectively).
|
104
|
+
3. Add `build/<debug|release>/<arch>` to the library search path.
|
105
|
+
|
106
|
+
#### Linux GTK ####
|
107
|
+
|
108
|
+
`apt-get libgtk-3-dev` installs the gtk dependency for library compilation.
|
109
|
+
|
110
|
+
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`.
|
111
|
+
|
112
|
+
#### Linux Zenity ####
|
113
|
+
|
114
|
+
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.
|
115
|
+
|
116
|
+
#### MacOS ####
|
117
|
+
|
118
|
+
On Mac OS, add `AppKit` to the list of frameworks.
|
119
|
+
|
120
|
+
#### Windows ####
|
121
|
+
|
122
|
+
On Windows, ensure you are linking against `comctl32.lib`.
|
123
|
+
|
124
|
+
## Usage ##
|
125
|
+
|
126
|
+
See `NFD.h` for API calls. See `tests/*.c` for example code.
|
127
|
+
|
128
|
+
After compiling, `build/bin` contains compiled test programs. The appropriate subdirectory under `build/lib` contains the built library.
|
129
|
+
|
130
|
+
## File Filter Syntax ##
|
131
|
+
|
132
|
+
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.
|
133
|
+
|
134
|
+
A wildcard filter is always added to every dialog.
|
135
|
+
|
136
|
+
### Separators ###
|
137
|
+
|
138
|
+
- `;` Begin a new filter.
|
139
|
+
- `,` Add a separate type to the filter.
|
140
|
+
|
141
|
+
#### Examples ####
|
142
|
+
|
143
|
+
`txt` The default filter is for text files. There is a wildcard option in a dropdown.
|
144
|
+
|
145
|
+
`png,jpg;psd` The default filter is for png and jpg files. A second filter is available for psd files. There is a wildcard option in a dropdown.
|
146
|
+
|
147
|
+
`NULL` Wildcard only.
|
148
|
+
|
149
|
+
## Iterating Over PathSets ##
|
150
|
+
|
151
|
+
See [test_opendialogmultiple.c](test/test_opendialogmultiple.c).
|
152
|
+
|
153
|
+
# Known Limitations #
|
154
|
+
|
155
|
+
I accept quality code patches, or will resolve these and other matters through support. See [contributing](docs/contributing.md) for details.
|
156
|
+
|
157
|
+
- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
|
158
|
+
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, however.
|
159
|
+
- GTK Zenity implementation's process exec error handling does not gracefully handle numerous error cases, choosing to abort rather than cleanup and return.
|
160
|
+
- GTK 3 spams one warning per dialog created.
|
161
|
+
|
162
|
+
# Copyright and Credit #
|
163
|
+
|
164
|
+
Copyright © 2014-2019 [Frogtoss Games](http://www.frogtoss.com), Inc.
|
165
|
+
File [LICENSE](LICENSE) covers all files in this repo.
|
166
|
+
|
167
|
+
Native File Dialog by Michael Labbe
|
168
|
+
<mike@frogtoss.com>
|
169
|
+
|
170
|
+
Tomasz Konojacki for [microutf8](http://puszcza.gnu.org.ua/software/microutf8/)
|
171
|
+
|
172
|
+
[Denis Kolodin](https://github.com/DenisKolodin) for mingw support.
|
173
|
+
|
174
|
+
[Tom Mason](https://github.com/wheybags) for Zenity support.
|
175
|
+
|
176
|
+
## Support ##
|
177
|
+
|
178
|
+
Directed support for this work is available from the original author under a paid agreement.
|
179
|
+
|
180
|
+
[Contact Frogtoss Games](http://www.frogtoss.com/pages/contact.html).
|