Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SYS(16) returning tilde in path name.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00474804
Message ID:
00476956
Vues:
28
>>If the shortcut uses a short file name, then that's what's available to SYS(16); the path is completely valid, it's just the short name rather than the long name. You can call the Win32API to convert it. You'd call GetLongPathName() to convert it in Win98/Win2K or later:
>>
>>DECLARE INTEGER GetLongPathName IN WIN32API STRING @, STRING @, INTEGER
>>cLongPath = REPL(CHR(0),261)
>>=GetLongPathName(cShortPath,@cLongPath,261)
>>? LEFT(cLongPath,AT(CHR(0),cLongPath)-1)
>>
>
>Ed,
>
>I'm not sure that I know what you mean by "the shortcut uses a short file name". This is just a simple lcReturn = SYS(16) and having lcReturn end up with a tilde in the path name. Even though the path with the tilde is valid I do need the complete path for comparison and display purposes. I'll give the GetLongPathName in Win32API a try. I wasn't aware of this function.
>

If the user starts the app by launching a Windows shortcut (a .LNK file), VFP's paths received at the command line are based on the paths in the Target and Starts In entries in the shortcut. If the paths are specified as short paths, VFP receives short paths; if they're LFNs, it gets LFNs. If it's in part short names and part long names, that's what you see.

Using short names in shortcuts has advantages; earlier VFP runtimes often refused to start when referencing an LFN that included a space, but ran just fine if started using the short name of the folder instead, and if the length of paths is an issue, short names generally require fewer characters for a given path. I tend to convert things to short names when there's a length issue, or I may need to interface with DOS or Win16 apps, or might find an older Novell file server without the OS2 Namespace enabled (there are still NetWare 3.12 and 3.20 servers at client sites; 3.12/3.20, in spite of Novell dropping support for them, present a stable file server environment which demands minimal hardware, given that it has the required services for a business; I'm still paranoid enough to check for LFN support before working in a folder, since SYS(2015) returns a 10 character string, it seems prudent to find out if the directory supports LFNs before using it for temporary file naming.)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform