Re: Testers required
- Posted by mattlewis (admin) Apr 15, 2010
- 1375 views
petelomax said...
So here is my third attempt, this time with SHGetFileInfo from shell32.
Before plugging it in, and in case anyone else has use for it, I thought I would post it here, maybe iron out a few bugs the easy way. You may need to delete a few "builtins\", and try some of your own files after "test code:".
Seems to work for me on XP with 4.0. I replaced your includes with:
include std/machine.e include std/dll.e include std/sort.e include std/filesys.e
Also, you might take a look at pathinfo(), which seems to do most of this work for you, although it splits the information into pieces.
I changed show() slightly to demonstrate:
procedure show(sequence filepath) sequence filepath2 puts(1,filepath) puts(1," ==>") filepath = getProperPath(filepath,icd) puts(1,filepath) puts(1,"\n") filepath2 = getProperPath(filepath,"") sequence filepath3 = pathinfo( filepath ) -- exact match expected... if not equal(filepath2,filepath) then ?9/0 end if -- ...including case, iff it exists if sequence(dir(filepath)) then filepath2 = getProperPath(UpperCase(filepath),"") if not equal(filepath2,filepath) then ?9/0 end if else puts(1," (nb ^ does not exist)\n") end if printf(1, "\tpath: %s\n" & "\tunqualified file name: %s\n" & "\tfilename: %s\n" & "\tfile extension: %s\n\tdrive id: %s\n", filepath3 ) end procedure
I get, for example:
..\Xedita\src\ ==>C:\euphoria\Development\Xedita\src\ (nb ^ does not exist) path: \euphoria\Development\Xedita\src unqualified file name: filename: file extension: drive id: C
Matt