https://github.com/juliagraphics/nativefiledialog.jl
mlabbe/nativefiledialog julia wrapper
https://github.com/juliagraphics/nativefiledialog.jl
julia package picker
Last synced: 30 days ago
JSON representation
mlabbe/nativefiledialog julia wrapper
- Host: GitHub
- URL: https://github.com/juliagraphics/nativefiledialog.jl
- Owner: JuliaGraphics
- License: mit
- Created: 2021-10-16T08:49:36.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-03T02:28:28.000Z (over 3 years ago)
- Last Synced: 2025-03-25T19:11:14.492Z (about 2 months ago)
- Topics: julia, package, picker
- Language: Julia
- Homepage:
- Size: 17.6 KB
- Stars: 31
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NativeFileDialog
[](https://github.com/Suavesito-Olimpiada/NativeFileDialog.jl/actions)
[](https://codecov.io/gh/Suavesito-Olimpiada/NativeFileDialog.jl)Wrapper of the library
[mlabbe/nativefiledialog](https://github.com/mlabbe/nativefiledialog) for
opening native OS dialogues for selecting files (or Gtk for Linux/FreeBSD).
Inspired by [this discourse
post](https://discourse.julialang.org/t/file-choose-in-julia/69703).## Installation
To install NativeFileDialog.jl, in the Julia REPL
```julia
julia> using Pkg
julia> Pkg.add("NativeFileDialog")
```# Documentation
NativeFileDialog.jl export four functions
```julia
pick_file(path=""; filterlist="")pick_multi_file(path=""; filterlist="")
pick_folder(path="")
save_file(path=""; filterlist="")
```The documentation of every one of these can be consulted in help mode in the
REPL (press `?` to change to help mode, `backspace` to exit), although their
names are really descriptive.### Path selection
The `path` positional argument sets the directory in which the dialog will be
open, by default `path` is set to `""` and the default open point is operating
system dependent.The `path` argument accepts `AbstractPath`s from
[FilePathsBase.jl](https://github.com/rofinn/FilePathsBase.jl). When
a `<:AbstractPath` has been passed it returns `nothing` on cancellations for
every one of the functions.### File filter lists
The `filterlist` keyword argument allows you to define multiple extension
filters for the dialogues. The syntax for doing this is `"ext1,ext2;ext3"`
where `ext1` and `ext2` are extensions of the first filter list and `ext3` is
an extension for the second one.Notice that multiple extensions for one list are separated by a comma (`,`),
while the different lists are separated by a semicolon (`;`).By default `filterlist` is set to `""` which means all kind of files are
accepted.## Examples
```julia
julia> using NativeFileDialogjulia> using FilePathsBase
julia> pick_file()
"/home/suave/primes.c"julia> pick_file(home()) # from FilePathsBase
p"/home/suave/donut.c"julia> pick_file()
"" # cancelled selectionjulia> pick_multi_file()
2-element Vector{String}:
"/home/suave/aek.cpp"
"/home/suave/aek.ppm"julia> pick_folder()
"/home/suave"
```