forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GET_MULTIPLE_FILENAMES bug - ROOT folder of a drive

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Mon Mar 14, 2016 11:49 pm    Post subject: GET_MULTIPLE_FILENAMES bug - ROOT folder of a drive Reply with quote

I ran the example given in the HELP file to assist me with another issue. What I got was a very odd behavior.

The code is:
Code:

     WINAPP
     INCLUDE <windows.ins>
     LOGICAL L,next
     CHARACTER*256 filename,filter,defpath
     filter = "Free Fortran files (*.f90)"//char(0)//"*.f90"//char(0) &
               //"All files (*.*)"//char(0)//"*.*"//char(0)//char(0)
     defpath = char(0) !Gives the current working directory
     L = .TRUE.
     next = .FALSE.
     DO WHILE(L)
       filename = char(0)
       L=GET_MULTIPLE_FILENAMES@(0,"Dialog Title",filename,256,filter,defpath,next)
       next = .TRUE.
       IF(L) PRINT*, trim(filename)
     END DO
     END


When run against my D: drive (and I've selected a few files), I get:
Code:

D:\\MISCSTMT001.FXS
D:\\msdia80.dll
D:\\Multiple transfer.psd


The doubled backslash should not be there. I have put a check in my code to prevent this for occurring.
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Tue Mar 15, 2016 9:42 am    Post subject: Reply with quote

Funny... I use the following code without problems - perhaps you may try it?

Code:
      WINAPP
      program test

      include <windows.ins>

      logical*2      l,n
      character*120  cpath,cfile,filter

      filter = 'Image files (*.JPG)'//char(0)
      cpath  = char(0)
      l = .true.
      n = .false.
      do while (l)
        cfile = '*.JPG'//char(0)
        l = GET_MULTIPLE_FILENAMES@(0,'Select',cfile,120,filter,cpath,n)
        if (l) print*,cfile
        n = .true.
      end do
      end


Wilfried
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Mar 15, 2016 3:03 pm    Post subject: Reply with quote

Yep, does it here, two different Windows 10 machines.

When you ran this, were your files at the root (i.e. C:\ or D:\)?

Works fine if not at the root.....
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Mar 15, 2016 8:11 pm    Post subject: Reply with quote

Also occurs under Windows 2000, and, like Windows 10, only when selecting root level of the drive.
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Wed Mar 16, 2016 3:48 pm    Post subject: Reply with quote

Indeed, the same behaviour at my PC when searching for files in the root directory. So you may use a trick - the changes are marked with !!!:

Code:
      WINAPP
      program test

      include <windows.ins>

      logical*2      l,n
      integer*4      root
      character*120  cpath,cfile,curdir@,filter

      filter = 'Image files (*.JPG)'//char(0)
      cpath  = char(0)
      root   = 0                             !!!
      if (leng(curdir@()) == 3) root = 1     !!!
      l = .true.
      n = .false.
      do while (l)
        cfile = '*.JPG'//char(0)
        l = GET_MULTIPLE_FILENAMES@(0,'Select',cfile,120,filter,cpath,n)
        if (root == 1) cfile = cfile(1:3)//cfile(5:)//char(0)   !!!
        if (l) print*,cfile
        n = .true.
      end do
      end


Wilfried
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Wed Mar 16, 2016 7:12 pm    Post subject: Reply with quote

This is fine when you are not changing the folder. However, you can use this function to go wherever you please to find files, then return the names.

The more general case is something like:

Code:

         nnn = index(PATTERN,':\\') ! look for the odd behavior
         if(nnn.ne.0) PATTERN = PATTERN(1:nnn+1)//PATTERN(nnn+3:) ! remove the :\\ and replace with :


where PATTERN is the pathname returned.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group