FLTK logo

[master] 65e5cd2 - kdialog native picker: properly handle spaces in filenames

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 65e5cd2 - kdialog native picker: properly handle spaces in filenames "Michael Tolly" Jun 29, 2022  
 
commit 65e5cd27cc80e63252cf78fefddb5b37c5c7619c
Author:     Michael Tolly <miketolly@gmail.com>
AuthorDate: Wed May 4 21:48:12 2022 -0500
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Jun 29 18:49:51 2022 +0200

    kdialog native picker: properly handle spaces in filenames
    
    Asks kdialog to use newlines for multiple files instead

 src/Fl_Native_File_Chooser_Kdialog.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git src/Fl_Native_File_Chooser_Kdialog.cxx src/Fl_Native_File_Chooser_Kdialog.cxx
index 5955659..820a6cb 100644
--- src/Fl_Native_File_Chooser_Kdialog.cxx
+++ src/Fl_Native_File_Chooser_Kdialog.cxx
@@ -102,7 +102,7 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
       break;
 
     case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
-      option = "--multiple --getopenfilename";
+      option = "--multiple --getopenfilename --separate-output";
       break;
 
     default:
@@ -145,15 +145,15 @@ int Fl_Kdialog_Native_File_Chooser_Driver::show() {
       delete[] _pathnames;
       char *p = data.all_files;
       int count = 1;
-      while ((p = strchr(p+1, ' '))) count++;
+      while ((p = strchr(p+1, '\n'))) count++;
       _pathnames = new char*[count];
       _tpathnames = 0;
-      char *q = strtok(data.all_files, " ");
+      char *q = strtok(data.all_files, "\n");
       while (q) {
         _pathnames[_tpathnames] = new char[strlen(q)+1];
         strcpy(_pathnames[_tpathnames], q);
         _tpathnames++;
-        q = strtok(NULL, " ");
+        q = strtok(NULL, "\n");
       }
     }
   }
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.