mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 13:05:35 +08:00
kdialog native picker: properly handle spaces in filenames
Asks kdialog to use newlines for multiple files instead
This commit is contained in:
committed by
ManoloFLTK
parent
47f0d63f19
commit
65e5cd27cc
@@ -102,7 +102,7 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
|
case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
|
||||||
option = "--multiple --getopenfilename";
|
option = "--multiple --getopenfilename --separate-output";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -145,15 +145,15 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
|
|||||||
delete[] _pathnames;
|
delete[] _pathnames;
|
||||||
char *p = data.all_files;
|
char *p = data.all_files;
|
||||||
int count = 1;
|
int count = 1;
|
||||||
while ((p = strchr(p+1, ' '))) count++;
|
while ((p = strchr(p+1, '\n'))) count++;
|
||||||
_pathnames = new char*[count];
|
_pathnames = new char*[count];
|
||||||
_tpathnames = 0;
|
_tpathnames = 0;
|
||||||
char *q = strtok(data.all_files, " ");
|
char *q = strtok(data.all_files, "\n");
|
||||||
while (q) {
|
while (q) {
|
||||||
_pathnames[_tpathnames] = new char[strlen(q)+1];
|
_pathnames[_tpathnames] = new char[strlen(q)+1];
|
||||||
strcpy(_pathnames[_tpathnames], q);
|
strcpy(_pathnames[_tpathnames], q);
|
||||||
_tpathnames++;
|
_tpathnames++;
|
||||||
q = strtok(NULL, " ");
|
q = strtok(NULL, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user