Man, I hate it when I can’t find old code to reuse. Maybe if I post it here I’ll at least be able to find it next time it’s wanted. *Heavy, theatrical, sigh*
Edited to add a bit more info.
I’ve gotten far too use to the casual, sloppy, chatty style of Facebook, I guess.
I’m writing code, in VFP, that will iterate through directories, collect all PDFs, and merge them using GhostScript. I want the full path and file names for one purpose, but Ghostscript seems to require short file names. At least so far as I can tell it stumbles with file names delimited with quotes. So, in short, I need both short and long paths, and I can iterate using native VFP functions with either long or short paths, but not both. Hence, my desire to collect long filenames, but convert to short paths to pass to GhostScript.
* Example ?GetShortPathName_VFP( GetFile() ) Function GetShortPathName_VFP (tcLongName) Assert Vartype( tcLongName ) = "C" ; Message "Did you mean to pass a bad parameter to " + ; Program( Program(-1) -1 ) + "?" Local lcFName, lnFName DeclareDlls_gspn() lcFName = Space(255) lnFName = GetShortPathName( tcLongName, @lcFName, 255) ClearDlls_gspn() Assert lnFName > 0 Message Program() + " failed." Return Left( lcFName, lnFName ) Endfunc Function DeclareDlls_gspn Declare Integer GetShortPathName In Win32API As ; GetShortPathName String, String, Integer Return Endfunc Function ClearDlls_gspn Clear Dlls "GetShortPathName" Return Endfunc