 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Fri Aug 01, 2008 3:34 pm Post subject: Blanks in filenames |
|
|
Here's an interesting conundrum:
Code: | INTEGER FUNCTION User_Manual_FN()
C ----------------------------------
INTEGER START_PPROCESS@
LOGICAL QUERY1, QUERY2
LOGICAL Q1, Q2
LOGICAL FEXISTS@
INCLUDE <WINDOWS.INS>
C -----------------------------------------------------------------
Q1=FEXISTS@('Help.chm', NERR1)
Q2=FEXISTS@('C:\Program Files\MyProg\Help.chm', NERR2)
WRITE(*,*) 'Q1=',Q1,' NERR1=', NERR1
WRITE(*,*) 'Q2=',Q2,' NERR2=', NERR2
INQUIRE(FILE='Help.chm',EXIST=QUERY1)
INQUIRE(FILE='C:\Program Files\MyProg\Help.chm', EXIST=QUERY2)
WRITE(*,*) 'QUERY1=', QUERY1
WRITE(*,*) 'QUERY2=', QUERY2
IF (QUERY1) THEN
IERR1=START_PPROCESS@('HH.EXE','Help.chm')
ELSE
IF (QUERY2) THEN
IERR2=START_PPROCESS@('HH.EXE','\Program Files\MyProg\Help.chm')
ENDIF
ENDIF
User_Manual_FN = 1
END |
It is a routine (mangled and abbreviated to fit in the forum) to display a compiled hypertext help file using Windows's own HH.EXE program. Interestingly, FEXISTS@ does more or less the same job as Fortran's INQUIRE statement. Neither can get through the space char in "Program Files", and so both report that the Help.chm file can't be opened when the program is properly installed in a folder in "Program Files".
None of FTN95's file routines seem to be able to break through a space char in a path, so (for example) GET_FILTERED_FILE@ is likely to be able to feed back a path that one can't follow. This seems to me to be a serious restriction in a contemporary Windows context.
Does anyone know of any workarounds (other than the obvious one of avoiding paths with space chars in)?
Since the copy of Help.chm is findable if the working directory is "C:\Program Files\MyProg\", then the routine works fine if the program is invoked from Explorer, but not from the Start Menu, Desktop or by a file association.
Fortunately, the installer I am using does have the capability of setting the working directory (InnoSetup: see WorkingDir setting in [Icons]), which solves the CHM problem, but not the general issue of being unable to open files in many folders.
Eddie |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Fri Aug 01, 2008 5:42 pm Post subject: |
|
|
Eddie,
Have you tried replacing the long format with spaces to the equivalent short 8.3 format?
instead of:-
C:\Program Files\MyProg\Help.chm
try using:-
C:\PROGRA~1\MyProg\Help.chm
cheers,
John |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Fri Aug 01, 2008 7:03 pm Post subject: |
|
|
John,
It works. My program and its folder have a long name ("StationMaster"), and:
Code: | IERR=START_PPROCESS@('HH.EXE',
& 'C:\Progra~1\StationMaster\StationMaster.chm') |
works fine. So does:
Code: | IERR=START_PPROCESS@('HH.EXE',
& 'C:\Progra~1\Statio~1\StationMaster.chm') |
and also:
Code: | IERR=START_PPROCESS@('HH.EXE',
& 'C:\Progra~1\Statio~1\Statio~1.chm') |
However, the rules for working out the abbreviated path name aren't simple. Primed with your suggestion, I knew how to Google, and came up with GetShortPathName, which is right there in Win32api.ins!
Eddie |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8217 Location: Salford, UK
|
Posted: Fri Aug 01, 2008 8:11 pm Post subject: |
|
|
FEXISTS@ works fine for me even with embedded spaces.
I am using the lastest release of salflibc.dll but I don't think that will make any difference. Are you sure that the file does exist?
If all else fails, try using the Windows API GetFileAttributes. This probably returns -1 if the file does not exist. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Fri Aug 01, 2008 11:47 pm Post subject: |
|
|
Oh dear, it works on my laptop (FAT32) but not on either desktop (NTFS) that I've tried it on. Some more investigation is called for - odd, because I usually find that things work least well on the laptop.
Things that sometimes work are worse than things that never work - the latter never lull you into a false sense of security!
The files are definitely there.
I'm using 4.90 (the Silverforst version!), and the bug fix list doesn't say anything about filename parsing.
Eddie |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8217 Location: Salford, UK
|
Posted: Sat Aug 02, 2008 8:10 am Post subject: |
|
|
Try backing up your salflibc.dll and copying in the one that works.
It is just possible that a general fix has had an impact on the way that strings are handled.
I am assuming that your DLL versions are different otherwise we will need to check out the different file systems for you. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Sun Aug 03, 2008 10:50 pm Post subject: |
|
|
Paul,
I'm getting very varied results. I think I need to try this out on a variety of machines to see what the common factors are.
Eddie |
|
Back to top |
|
 |
Andrew
Joined: 09 Sep 2004 Posts: 232 Location: Frankfurt, Germany
|
Posted: Mon Aug 04, 2008 9:15 am Post subject: |
|
|
There is a utility, saldiag.exe that can be found in the FTN95 installation folder. This will check the location and version of salflibc.dll that is being used. This sounds like a versioning issue. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Mon Aug 04, 2008 9:38 am Post subject: |
|
|
Eddie,
I tried a variant of your program and it worked ok on my NTFS notebook with ftn95 Ver 4.9.1 ( I maintain an old version on the notebook ).
The only related problem I had with blanks in tree names was to account for "blank in name" format when reading tokens on the command line. Fortran OPEN statements also work fine.
John
Code: |
integer User_Manual_FN, i
external User_Manual_FN
!
i = User_Manual_FN ()
end
INTEGER FUNCTION User_Manual_FN()
! ----------------------------------
INTEGER START_PPROCESS@, Ierr1, Ierr2, Nerr1, Nerr2
LOGICAL QUERY1, QUERY2
LOGICAL FEXISTS@, Q1, Q2
INCLUDE <WINDOWS.INS>
! -----------------------------------------------------------------
Q1=FEXISTS@('Ftn95.chm', NERR1)
Q2=FEXISTS@('C:\Program Files\Salford Software\FTN95\Ftn95.chm', NERR2)
WRITE(*,*) 'Q1=',Q1,' NERR1=', NERR1
WRITE(*,*) 'Q2=',Q2,' NERR2=', NERR2
INQUIRE(FILE='Help.chm',EXIST=QUERY1)
INQUIRE(FILE='C:\Program Files\Salford Software\FTN95\Ftn95.chm', EXIST=QUERY2)
WRITE(*,*) 'QUERY1=', QUERY1
WRITE(*,*) 'QUERY2=', QUERY2
IF (QUERY1) THEN
IERR1=START_PPROCESS@('HH.EXE','Help.chm')
ELSE
IF (QUERY2) THEN
IERR2=START_PPROCESS@('HH.EXE','\Program Files\Salford Software\FTN95\Ftn95.chm')
ENDIF
ENDIF
User_Manual_FN = 1
END
|
|
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Mon Aug 04, 2008 10:32 am Post subject: |
|
|
Thanks to everyone who responded. Since the consensus is that it ought to work, and that no-one else seems to share the experience, I may spend some time reinstalling Windows on the affected machine(s) and see if that helps.
Eddie |
|
Back to top |
|
 |
|
|
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
|