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

sync with mlabbe:devel #2

Open
wants to merge 31 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a543da8
Fix simple_exec's waitpid error
jmdejong Jan 6, 2019
b58794c
Update issue templates
mlabbe Sep 30, 2019
67345b8
Merge branch 'devel'
mlabbe Sep 30, 2019
ad0b798
Fix CopyNFDCharToWChar() (called by SetDefaultPath()) asserting on Wi…
blep Mar 27, 2020
189710c
Source files using relative path allow compiling without extra includ…
ocornut Nov 10, 2020
8b9b803
Disable warning using strncat() with vs2019 (somehow didn't get it wi…
ocornut Nov 10, 2020
7286ab2
GTK: Work around X11 focus issue (Fixes #79)
thp Nov 29, 2020
a1bb9d1
Gtk: Apply focus fix to all dialog variants
thp Nov 29, 2020
d7ec5cd
win32 support for filenames in default paths
mlabbe Jan 7, 2021
53a0348
Linux fix default path/filename not working at all when doesn't exist
mlabbe Jan 7, 2021
3f3e795
macos support filenames in default paths
mlabbe Jan 7, 2021
48b3f14
Merge branch 'master' into devel
mlabbe Jan 8, 2021
be028fc
win32 set default extension
mlabbe Jan 8, 2021
c0e4910
gtk polyfill: add extension from selected filter
mlabbe Jan 8, 2021
8e6bc78
hand-merge https://github.com/mlabbe/nativefiledialog/pull/92
mlabbe Jan 8, 2021
04362c7
remove benign warning
mlabbe Jan 8, 2021
f04d99e
add nfd_free
mlabbe Jan 8, 2021
dbb8a4b
allow compiling without extra include path #91
mlabbe Jan 8, 2021
eedbd62
Merge pull request #81 from blep/devel
mlabbe Jan 8, 2021
23b563a
Merge pull request #61 from jmdejong/patch-2
mlabbe Jan 8, 2021
a93a3c2
fix warnings, errors introduced in last pr
mlabbe Jan 8, 2021
8f15758
clang-format pass
mlabbe Jan 8, 2021
7605edf
support arm64 linux
mlabbe Jan 8, 2021
4b2d762
fix arm build config leaking to windows
mlabbe Jan 8, 2021
47c3d7d
premake5 dist run
mlabbe Jan 8, 2021
01de5ac
known issues readme update
mlabbe Jan 9, 2021
eb29acc
macos focus bugfix
mlabbe Jan 9, 2021
0647a4e
macos arm64 and fat binary support
Jan 15, 2021
29bd31d
suggest survey to user
mlabbe Jan 16, 2021
4835a5d
fix mingw, update ftg_core, change build msg
mlabbe Jan 16, 2021
2850c97
fix recently introduced xcode error
mlabbe Jan 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# main
IndentWidth: 4
BreakBeforeBraces: Linux
AlwaysBreakAfterDefinitionReturnType: true
UseTab: Never
AllowShortIfStatementsOnASingleLine: false
ColumnLimit: 80
IndentCaseLabels: false

# for macros
AlignEscapedNewlinesLeft: false
IndentPPDirectives: AfterHash

# i love alignment
BinPackArguments: false
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: false
AlignTrailingComments: true
AlignConsecutiveDeclarations: true
AlignAfterOpenBracket: Align

# most flow control must be indented for easy eye scanning
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortLoopsOnASingleLine: true

# braces
BraceWrapping:
BeforeElse: false
AfterControlStatement: false
AfterFunction: false
AfterStruct: false
AfterUnion: false
IndentBraces: false

# other
AlignOperands: true
MaxEmptyLinesToKeep: 3
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Left
DerivePointerAlignment: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
IncludeBlocks: Preserve
SortIncludes: false
BreakBeforeBinaryOperators: None
ReflowComments: true


# penalties
PenaltyExcessCharacter: 2
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Compilation Environment**

- OS (eg: OSX 10.14, Ubuntu 18.04):
- Compiler (eg: GCC, Clang):
- Compiler Version (eg: MSVC 2017):
- Build directory used (eg: `build/gmake_linux`:
- Have I attempted to reproduce the problem on the `devel` branch?

**Describe the bug**

_A clear and concise description of what the bug is._

**Compilation output**

_If compiling with a makefile, paste the output of `make verbose=1` which includes Makefile steps._

**Additional context**

_Add any other context about the problem here._

**User Description**

_Are you using NFD as an individual, a small company (less than ten employees) or a larger organization?
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Features:
- Simple universal file filter syntax.
- Paid support available.
- Multiple file selection support.
- 64-bit and 32-bit friendly.
- x64, x86 and arm64 (Linux) support
- GCC, Clang, Xcode, Mingw and Visual Studio supported.
- No third party dependencies for building or linking.
- Support for Vista's modern `IFileDialog` on Windows.
Expand All @@ -34,7 +34,7 @@ int main( void )
if ( result == NFD_OKAY ) {
puts("Success!");
puts(outPath);
free(outPath);
NFD_Free(outPath);
}
else if ( result == NFD_CANCEL ) {
puts("User pressed cancel.");
Expand Down Expand Up @@ -77,6 +77,38 @@ release | what's new | date
<i></i> | remove deprecated scons | aug 2019
<i></i> | fix mingw compilation | aug 2019
<i></i> | -Wextra warning cleanup | aug 2019
1.2.0 | defaultPath can specify files now | jan 2021
<i></i> | extension automatically added when saving | jan 2021
<i></i> | GTK dialog focus bugfix | jan 2021
<i></i> | Macos dialog focus bugfix | jan 2021
<i></i> | Added NFD_Free() | jan 2021
<i></i> | Fix vs2019 debug assert | jan 2021
<i></i> | Fix zenity debug assert | jan 2021
<i></i> | add clang-format | jan 2021
<i></i> | Linux arm64 support | jan 2021
<i></i> | Apple Silicon support | jan 2021
<i></i> | Macos fat binary builds | jan 2021

## Usage Survey ##

Do you use Native File Dialog? It helps me to understand how.

There is a totally optional usage survey. Share how you use Native File Dialog. Big and small projects, public and private may share.

[Click here to fill out the usage survey.](https://forms.gle/ApWCFsXeCVxpg4XLA "Usage survey").


### Breaking and Notable Changes ###

There are no ABI breaking changes in NFD's history.

#### 1.2.0 ####

- If argument `filterList` is specified, a default extension is appended to the filename if the user does not take an action to specify one. Previously no extension was added on the GTK3 and Win32 implementations, but was added on MacOS.

- Argument `defaultPath` sometimes failed to display the specified directory if a file was included in the `defaultPath` but the file did not exist. In 1.2.0, polyfill was added to display the directory even if the file doesn't exist.

- `NFD_Free()` was added, and can be used in place of `free()`. This was done to facilitate usage of NFD in a DLL on Windows. Otherwise, there is no difference.

## Building ##

Expand All @@ -90,12 +122,14 @@ Previously, NFD used SCons to build. As of 1.1.6, SCons support has been remove

### Makefiles ###

The makefile offers up to four options, with `release_x64` as the default.
The makefile offers up to six options, with `release_x64` as the default.

make config=release_x86
make config=release_x64
make config=release_arm64
make config=debug_x86
make config=debug_x64
make config=debug_arm64

### Compiling Your Programs ###

Expand All @@ -111,7 +145,7 @@ On Linux, you have the option of compiling and linking against GTK. If you use

#### Linux Zenity ####

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.
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. For a full list of Zenity limitations, see "Known Limitations" below.

#### MacOS ####

Expand Down Expand Up @@ -156,12 +190,15 @@ I accept quality code patches, or will resolve these and other matters through s

- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, however.
- GTK Zenity implementation's process exec error handling does not gracefully handle numerous error cases, choosing to abort rather than cleanup and return.
- GTK 3 spams one warning per dialog created.
- GTK 3 sometimes spams one warning per dialog created, depending on how GTK3 was built.
- The GTK Zenity backend (non-default) is a lightweight alternative intended only for small programs:
- It errors out if Zenity is not installed on the user's system
- This backend's process exec error handling does not gracefully handle numerous error cases, choosing to abort rather than cleanup and return.
- Unlike the other backends, the Zenity backend does not return implied extensions from filterlists. [#95](https://github.com/mlabbe/nativefiledialog/issues/95 "Issue 95")

# Copyright and Credit #

Copyright &copy; 2014-2019 [Frogtoss Games](http://www.frogtoss.com), Inc.
Copyright &copy; 2014-2021 [Frogtoss Games](http://www.frogtoss.com), Inc.
File [LICENSE](LICENSE) covers all files in this repo.

Native File Dialog by Michael Labbe
Expand All @@ -173,6 +210,8 @@ Tomasz Konojacki for [microutf8](http://puszcza.gnu.org.ua/software/microutf8/)

[Tom Mason](https://github.com/wheybags) for Zenity support.

Various pull requests and bugfixes -- thanks to the original authors.

## Support ##

Directed support for this work is available from the original author under a paid agreement.
Expand Down
16 changes: 16 additions & 0 deletions build/gmake_linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ ifeq ($(config),release_x86)
test_opendialogmultiple_config = release_x86
test_savedialog_config = release_x86
endif
ifeq ($(config),release_arm64)
nfd_config = release_arm64
test_pickfolder_config = release_arm64
test_opendialog_config = release_arm64
test_opendialogmultiple_config = release_arm64
test_savedialog_config = release_arm64
endif
ifeq ($(config),debug_x64)
nfd_config = debug_x64
test_pickfolder_config = debug_x64
Expand All @@ -36,6 +43,13 @@ ifeq ($(config),debug_x86)
test_opendialogmultiple_config = debug_x86
test_savedialog_config = debug_x86
endif
ifeq ($(config),debug_arm64)
nfd_config = debug_arm64
test_pickfolder_config = debug_arm64
test_opendialog_config = debug_arm64
test_opendialogmultiple_config = debug_arm64
test_savedialog_config = debug_arm64
endif

PROJECTS := nfd test_pickfolder test_opendialog test_opendialogmultiple test_savedialog

Expand Down Expand Up @@ -86,8 +100,10 @@ help:
@echo "CONFIGURATIONS:"
@echo " release_x64"
@echo " release_x86"
@echo " release_arm64"
@echo " debug_x64"
@echo " debug_x86"
@echo " debug_arm64"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
Expand Down
66 changes: 66 additions & 0 deletions build/gmake_linux/nfd.make
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ ifeq ($(config),release_x64)
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:
Expand Down Expand Up @@ -58,6 +60,37 @@ ifeq ($(config),release_x86)
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:

endif

ifeq ($(config),release_arm64)
RESCOMP = windres
TARGETDIR = ../lib/Release/arm64
TARGET = $(TARGETDIR)/libnfd.a
OBJDIR = ../obj/arm64/Release/nfd
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -s
LINKCMD = $(AR) -rcs "$@" $(OBJECTS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:
Expand Down Expand Up @@ -85,6 +118,8 @@ ifeq ($(config),debug_x64)
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:
Expand Down Expand Up @@ -112,6 +147,37 @@ ifeq ($(config),debug_x86)
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:

endif

ifeq ($(config),debug_arm64)
RESCOMP = windres
TARGETDIR = ../lib/Debug/arm64
TARGET = $(TARGETDIR)/libnfd_d.a
OBJDIR = ../obj/arm64/Debug/nfd
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS)
LINKCMD = $(AR) -rcs "$@" $(OBJECTS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
@echo Running postbuild commands
@echo "\n *** Do you use Native File Dialog? Please take the user survey to help development: https://forms.gle/ApWCFsXeCVxpg4XLA" ***
endef
all: prebuild prelink $(TARGET)
@:
Expand Down
Loading