NFD
relies on preview features of the Java platform:
NFD
refers to one or more preview APIs:MemorySegment
,ValueLayout
.
Native File Dialog Extended
A small C library with that portably invokes native file open, folder select and file 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.
Features:
- Supports Windows, MacOS, and Linux
- Friendly names for filters (e.g.
Java Source files (*.java;*.kt)
instead of(*.java;*.kt)
) on platforms that support it - Automatically append file extension on platforms where users expect it
- Support for setting a default folder path
- Support for setting a default file name (e.g.
Untitled.java
) - Consistent UTF-8 support on all platforms
- Native character set (UTF-16LE) support on Windows
- Initialization and de-initialization of platform library (e.g. COM (Windows) / GTK (Linux GTK) / D-Bus (Linux portal)) decoupled from dialog functions, so applications can choose when to initialize/de-initialize
- Multiple file selection support (for file open dialog)
- No third party dependencies
Basic Usages
import overrungl.util.value.Pair;
void main() {
NFD.init();
try (MemoryStack stack = MemoryStack.stackPush()) {
String[] outPath = new String[1];
var filterItem = NFDNFilterItem.create(stack,
new Pair<>("Source code", "java"),
new Pair<>("Image file", "png,jpg"));
var result = NFD.openDialogN(outPath, filterItem, null);
switch (result) {
case ERROR -> System.err.println("Error: " + NFD.getError());
case OKAY -> System.out.println("Success! " + outPath[0]);
case CANCEL -> System.out.println("User pressed cancel.");
}
}
NFD.quit();
}
File Filter Syntax
Files can be filtered by file extension groups:var filterItem = NFDNFilterItem.create(allocator,
new Pair<>("Source code", "java"),
new Pair<>("Image file", "png,jpg"));
A file filter is a pair of strings comprising the friendly name and the specification (multiple file extensions are comma-separated).
A list of file filters can be passed as an argument when invoking the library.
A wildcard filter is always added to every dialog.
Note: On MacOS, the file dialogs do not have friendly names and there is no way to switch between filters, so the filter specifications are combined (e.g. "java,kt,png,jpg"). The filter specification is also never explicitly shown to the user. This is usual MacOS behaviour and users expect it.
Note 2: You must ensure that the specification string is non-empty and that every file extension has at least one character. Otherwise, bad things might ensue (i.e. undefined behaviour).
Note 3: On Linux, the file extension is appended (if missing) when the user presses down the "Save" button. The appended file extension will remain visible to the user, even if an overwrite prompt is shown and the user then presses "Cancel".
Note 4: On Windows, the default folder parameter is only used if there is no recently used folder available. Otherwise, the default folder will be the folder that was last used. Internally, the Windows implementation calls IFileDialog::SetDefaultFolder(IShellItem). This is usual Windows behaviour and users expect it.
Iterating Over PathSets
A file open dialog that supports multiple selection produces a PathSet, which is a thin abstraction over the platform-specific collection. There are two ways to iterate over a PathSet:Accessing by index
This method does array-like access on the PathSet, and is the easiest to use. However, on certain platforms (Linux, and possibly Windows), it takes O(N²) time in total to iterate the entire PathSet, because the underlying platform-specific implementation uses a linked list.Using an enumerator (experimental)
This method uses an enumerator object to iterate the paths in the PathSet. It is guaranteed to take O(N) time in total to iterate the entire PathSet.
See NFDEnumerator
.
This API is experimental, and subject to change.
- Since:
- 0.1.0
- Author:
- squid233
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ValueLayoutPREVIEW
The type of the path-set size (long
for Windows and Mac OS X,int
for others). -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear the errorstatic void
freePathN
(@NativeType("nfdnchar_t*") MemorySegmentPREVIEW filePath) free a file path that was returned by the dialogsstatic void
freePathU8
(@NativeType("nfdu8char_t*") MemorySegmentPREVIEW filePath) free a file path that was returnedstatic String
getError()
Get last error -- set whenNFDResult
returnsNFDResult.ERROR
static NFDResult
init()
initialize NFD - call this for every thread that might use NFD, before calling any other NFD functions on that threadstatic @NativeType("const char*") MemorySegmentPREVIEW
Get last error -- set whenNFDResult
returnsNFDResult.ERROR
static NFDResult
nopenDialogMultipleN
(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) multiple file open dialogstatic NFDResult
nopenDialogMultipleU8
(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) multiple file open dialogstatic NFDResult
nopenDialogN
(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) single file open dialogstatic NFDResult
nopenDialogU8
(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) single file open dialogstatic NFDResult
npathSetEnumNextN
(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, @NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath) Gets the next item from the path set enumerator.static NFDResult
npathSetEnumNextU8
(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, @NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath) Gets the next item from the path set enumerator.static NFDResult
npathSetGetCount
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, @NativeType("nfdpathsetsize_t*") MemorySegmentPREVIEW count) Gets the number of entries stored in pathSetstatic NFDResult
npathSetGetPathN
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, @NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath) Gets the UTF-8 path at offset indexstatic NFDResult
npathSetGetPathU8
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, @NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath) Gets the UTF-8 path at offset indexstatic NFDResult
npickFolderN
(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) select folder dialogstatic NFDResult
npickFolderU8
(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) select folder dialogstatic NFDResult
nsaveDialogN
(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultName) save dialogstatic NFDResult
nsaveDialogU8
(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultName) save dialogstatic NFDResult
openDialogMultipleN
(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, NFDNFilterItem.Buffer filterList, String defaultPath) multiple file open dialogstatic NFDResult
openDialogMultipleU8
(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, NFDU8FilterItem.Buffer filterList, String defaultPath) multiple file open dialogstatic NFDResult
openDialogN
(String[] outPath, NFDNFilterItem.Buffer filterList, String defaultPath) single file open dialogstatic NFDResult
openDialogU8
(String[] outPath, NFDU8FilterItem.Buffer filterList, String defaultPath) single file open dialogstatic NFDResult
pathSetEnumNextN
(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, String[] outPath) Gets the next item from the path set enumerator.static NFDResult
pathSetEnumNextU8
(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, String[] outPath) Gets the next item from the path set enumerator.static void
pathSetFree
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet) Free the pathSetstatic void
pathSetFreeEnum
(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator) Frees an enumerator of the path set.static void
pathSetFreePathN
(@NativeType("const nfdnchar_t*") MemorySegmentPREVIEW filePath) Free the path gotten bypathSetGetPathN(java.lang.foreign.MemorySegment, long, java.lang.String[])
PREVIEWstatic void
pathSetFreePathU8
(MemorySegmentPREVIEW filePath) Free the path gotten bypathSetGetPathU8(java.lang.foreign.MemorySegment, long, java.lang.String[])
PREVIEWstatic Tuple2.OfObjLong
<NFDResult> pathSetGetCount
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet) Gets the number of entries stored in pathSetstatic NFDResult
pathSetGetCount
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long[] count) Gets the number of entries stored in pathSetstatic NFDResult
pathSetGetEnum
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, @NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW outEnumerator) Gets an enumerator of the path set.static NFDResult
pathSetGetPathN
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, String[] outPath) Gets the UTF-8 path at offset indexstatic NFDResult
pathSetGetPathU8
(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, String[] outPath) Gets the UTF-8 path at offset indexstatic NFDResult
pickFolderN
(String[] outPath, String defaultPath) select folder dialogstatic NFDResult
pickFolderU8
(String[] outPath, String defaultPath) select folder dialogstatic void
quit()
call this to de-initialize NFD, ifinit()
returnedNFDResult.OKAY
static NFDResult
saveDialogN
(String[] outPath, NFDNFilterItem.Buffer filterList, String defaultPath, String defaultName) save dialogstatic NFDResult
saveDialogU8
(String[] outPath, NFDU8FilterItem.Buffer filterList, String defaultPath, String defaultName) save dialog
-
Field Details
-
PATH_SET_SIZE
The type of the path-set size (long
for Windows and Mac OS X,int
for others).
-
-
Method Details
-
freePathN
free a file path that was returned by the dialogsNote: use
NFD::pathSetFreePath
to free path from path-set instead of this function- Parameters:
filePath
- the file path
-
init
initialize NFD - call this for every thread that might use NFD, before calling any other NFD functions on that thread- Returns:
- the result
-
quit
public static void quit()call this to de-initialize NFD, ifinit()
returnedNFDResult.OKAY
-
nopenDialogN
public static NFDResult nopenDialogN(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) single file open dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathN(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
openDialogN
public static NFDResult openDialogN(String[] outPath, NFDNFilterItem.Buffer filterList, String defaultPath) single file open dialog- Parameters:
outPath
- the out pathfilterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
nopenDialogMultipleN
public static NFDResult nopenDialogMultipleN(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) multiple file open dialog- Parameters:
outPaths
- It is the caller's responsibility to free*outPaths
viapathSetFree(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
openDialogMultipleN
public static NFDResult openDialogMultipleN(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, NFDNFilterItem.Buffer filterList, String defaultPath) multiple file open dialog- Parameters:
outPaths
- It is the caller's responsibility to free*outPaths
viapathSetFree(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
nsaveDialogN
public static NFDResult nsaveDialogN(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnfilteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultName) save dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathN(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decidedefaultName
- the default name of the file- Returns:
- the result
-
saveDialogN
public static NFDResult saveDialogN(String[] outPath, NFDNFilterItem.Buffer filterList, String defaultPath, String defaultName) save dialog- Parameters:
outPath
- the out pathfilterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decidedefaultName
- the default name of the file- Returns:
- the result
- See Also:
-
npickFolderN
public static NFDResult npickFolderN(@NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdnchar_t*") MemorySegmentPREVIEW defaultPath) select folder dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathN(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
pickFolderN
select folder dialog- Parameters:
outPath
- the out pathdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
ngetError
Get last error -- set whenNFDResult
returnsNFDResult.ERROR
The memory is owned by NFD and should not be freed by user code.
This is always ASCII printable characters, so it can be interpreted as UTF-8 without any conversion.
- Returns:
- the last error that was set, or NULL if there is no error.
-
getError
Get last error -- set whenNFDResult
returnsNFDResult.ERROR
- Returns:
- the last error that was set, or NULL if there is no error.
- See Also:
-
clearError
public static void clearError()clear the error -
npathSetGetCount
public static NFDResult npathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, @NativeType("nfdpathsetsize_t*") MemorySegmentPREVIEW count) Gets the number of entries stored in pathSetnote that some paths might be invalid (NFD_ERROR will be returned by NFD_PathSet_GetPath), so we might not actually have this number of usable paths
- Parameters:
pathSet
- the path-setcount
- the count- Returns:
- the result
-
pathSetGetCount
public static NFDResult pathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long[] count) Gets the number of entries stored in pathSet- Parameters:
pathSet
- the path-setcount
- the count- Returns:
- the result
- See Also:
-
pathSetGetCount
public static Tuple2.OfObjLong<NFDResult> pathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet) Gets the number of entries stored in pathSet- Parameters:
pathSet
- the path-set- Returns:
- the result and the count
- See Also:
-
npathSetGetPathN
public static NFDResult npathSetGetPathN(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, @NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath) Gets the UTF-8 path at offset index- Parameters:
pathSet
- the path-setindex
- the indexoutPath
- It is the caller's responsibility to free*outPath
viapathSetFreePathN(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
- Returns:
- the result
-
pathSetGetPathN
public static NFDResult pathSetGetPathN(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, String[] outPath) Gets the UTF-8 path at offset index- Parameters:
pathSet
- the path-setindex
- the indexoutPath
- the out path- Returns:
- the result
- See Also:
-
pathSetFreePathN
Free the path gotten bypathSetGetPathN(java.lang.foreign.MemorySegment, long, java.lang.String[])
PREVIEW- Parameters:
filePath
- the path
-
pathSetGetEnum
public static NFDResult pathSetGetEnum(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, @NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW outEnumerator) Gets an enumerator of the path set.- Parameters:
pathSet
- the path setoutEnumerator
- It is the caller's responsibility to freeenumerator
viapathSetFreeEnum(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
, and it should be freed before freeing the path-set.- Returns:
- the result
-
pathSetFreeEnum
public static void pathSetFreeEnum(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator) Frees an enumerator of the path set.- Parameters:
enumerator
- the enumerator
-
npathSetEnumNextN
public static NFDResult npathSetEnumNextN(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, @NativeType("nfdnchar_t**") MemorySegmentPREVIEW outPath) Gets the next item from the path set enumerator.If there are no more items, then *outPaths will be set to NULL.
- Parameters:
enumerator
- the enumeratoroutPath
- It is the caller's responsibility to free*outPath
viapathSetFreePathN(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
and*outPath
is not null- Returns:
- the result
-
pathSetEnumNextN
public static NFDResult pathSetEnumNextN(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, String[] outPath) Gets the next item from the path set enumerator.- Parameters:
enumerator
- the enumeratoroutPath
- the out path- Returns:
- the result
- See Also:
-
pathSetFree
Free the pathSet- Parameters:
pathSet
- the pathSet
-
freePathU8
free a file path that was returned- Parameters:
filePath
- the file path
-
nopenDialogU8
public static NFDResult nopenDialogU8(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) single file open dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathU8(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
openDialogU8
public static NFDResult openDialogU8(String[] outPath, NFDU8FilterItem.Buffer filterList, String defaultPath) single file open dialog- Parameters:
outPath
- the out pathfilterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
nopenDialogMultipleU8
public static NFDResult nopenDialogMultipleU8(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) multiple file open dialog- Parameters:
outPaths
- It is the caller's responsibility to free*outPaths
viapathSetFree(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
openDialogMultipleU8
public static NFDResult openDialogMultipleU8(@NativeType("const nfdpathset_t**") MemorySegmentPREVIEW outPaths, NFDU8FilterItem.Buffer filterList, String defaultPath) multiple file open dialog- Parameters:
outPaths
- It is the caller's responsibility to free*outPaths
viapathSetFree(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
nsaveDialogU8
public static NFDResult nsaveDialogU8(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8filteritem_t*") MemorySegmentPREVIEW filterList, int filterCount, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultName) save dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathU8(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
filterList
- the filter listfilterCount
- If filterCount is zero, filterList is ignored (you can use NULL)defaultPath
- If defaultPath is NULL, the operating system will decidedefaultName
- the default name of the file- Returns:
- the result
-
saveDialogU8
public static NFDResult saveDialogU8(String[] outPath, NFDU8FilterItem.Buffer filterList, String defaultPath, String defaultName) save dialog- Parameters:
outPath
- the out pathfilterList
- the filter listdefaultPath
- If defaultPath is NULL, the operating system will decidedefaultName
- the default name of the file- Returns:
- the result
- See Also:
-
npickFolderU8
public static NFDResult npickFolderU8(@NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath, @NativeType("const nfdu8char_t*") MemorySegmentPREVIEW defaultPath) select folder dialog- Parameters:
outPath
- It is the caller's responsibility to free*outPath
viafreePathU8(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
defaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
-
pickFolderU8
select folder dialog- Parameters:
outPath
- the out pathdefaultPath
- If defaultPath is NULL, the operating system will decide- Returns:
- the result
- See Also:
-
npathSetGetPathU8
public static NFDResult npathSetGetPathU8(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, @NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath) Gets the UTF-8 path at offset index- Parameters:
pathSet
- the path-setindex
- the indexoutPath
- It is the caller's responsibility to free*outPath
viapathSetFreePathU8(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
- Returns:
- the result
-
pathSetGetPathU8
public static NFDResult pathSetGetPathU8(@NativeType("const nfdpathset_t*") MemorySegmentPREVIEW pathSet, long index, String[] outPath) Gets the UTF-8 path at offset index- Parameters:
pathSet
- the path-setindex
- the indexoutPath
- the out path- Returns:
- the result
- See Also:
-
npathSetEnumNextU8
public static NFDResult npathSetEnumNextU8(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, @NativeType("nfdu8char_t**") MemorySegmentPREVIEW outPath) Gets the next item from the path set enumerator.If there are no more items, then *outPaths will be set to NULL.
- Parameters:
enumerator
- the enumeratoroutPath
- It is the caller's responsibility to free*outPath
viapathSetFreePathU8(java.lang.foreign.MemorySegment)
PREVIEW if this function returnsNFDResult.OKAY
and*outPath
is not null- Returns:
- the result
-
pathSetEnumNextU8
public static NFDResult pathSetEnumNextU8(@NativeType("nfdpathsetenum_t*") MemorySegmentPREVIEW enumerator, String[] outPath) Gets the next item from the path set enumerator.- Parameters:
enumerator
- the enumeratoroutPath
- the out path- Returns:
- the result
- See Also:
-
pathSetFreePathU8
Free the path gotten bypathSetGetPathU8(java.lang.foreign.MemorySegment, long, java.lang.String[])
PREVIEW- Parameters:
filePath
- the path
-
NFD
when preview features are enabled.