IDK man, changes I guess
This commit is contained in:
@@ -158,27 +158,34 @@ func runDialog(args ...string) ([]string, error) {
|
||||
return lines, nil
|
||||
}
|
||||
|
||||
// videoPatterns lists every media extension in lower and upper case, since
|
||||
// GTK file filters are case-sensitive.
|
||||
func videoPatterns() string {
|
||||
// filePatterns lists every extension in lower and upper case, since GTK file
|
||||
// filters are case-sensitive.
|
||||
func filePatterns(exts []string) string {
|
||||
var pats []string
|
||||
for _, e := range mediaExts {
|
||||
for _, e := range exts {
|
||||
pats = append(pats, "*."+e, "*."+strings.ToUpper(e))
|
||||
}
|
||||
return strings.Join(pats, " ")
|
||||
}
|
||||
|
||||
func nativeOpenDialog(title, dir string) ([]string, error) {
|
||||
func nativeOpenDialog(k fileKind, dir string) ([]string, error) {
|
||||
if !isDir(dir) {
|
||||
dir, _ = os.UserHomeDir()
|
||||
}
|
||||
pats := filePatterns(k.Exts)
|
||||
if isKDialog() {
|
||||
return runDialog("--title", title, "--multiple", "--separate-output",
|
||||
"--getopenfilename", dir, "Video files ("+videoPatterns()+")\nAll files (*)")
|
||||
args := []string{"--title", k.Title}
|
||||
if k.Multiple {
|
||||
args = append(args, "--multiple", "--separate-output")
|
||||
}
|
||||
return runDialog(append(args, "--getopenfilename", dir, k.Label+" ("+pats+")\nAll files (*)")...)
|
||||
}
|
||||
return runDialog("--file-selection", "--multiple", "--separator=\n", "--title="+title,
|
||||
"--filename="+strings.TrimSuffix(dir, "/")+"/",
|
||||
"--file-filter=Video files | "+videoPatterns(), "--file-filter=All files | *")
|
||||
args := []string{"--file-selection", "--title=" + k.Title}
|
||||
if k.Multiple {
|
||||
args = append(args, "--multiple", "--separator=\n")
|
||||
}
|
||||
return runDialog(append(args, "--filename="+strings.TrimSuffix(dir, "/")+"/",
|
||||
"--file-filter="+k.Label+" | "+pats, "--file-filter=All files | *")...)
|
||||
}
|
||||
|
||||
func nativeSaveDialog(title, path string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user