Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange directories from sys(16) , curdir()
Message
From
14/04/2002 09:51:23
 
 
To
13/04/2002 20:52:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00644667
Message ID:
00644811
Views:
12
>>Michael,
>>What would it matter. In any case they're same dirs. But if you're desperate to correct it you could use winAPI :
>
>Im my case it does matter since some comparisons are made against this directory in a long format which is picked up from ini file. And in this case the functions suggested by you are very handy, indeed.
>
>
>>
>>
>>DECLARE integer GetLongPathName IN WIN32API ;
>>	string @ lpszShortPath, string @ lpszLongPath, integer cchBuffer
>>DECLARE integer GetShortPathName IN WIN32API ;
>>  string @ lpszLongPath, string @ lpszShortPath, integer cchBuffer
>>
>>lcDir = SYS(5)+CURDIR()
>>STORE SPACE(300) TO lpszShortPath, lpszLongPath
>>lnLen = GetShortPathName(lcDir,@lpszShortPath, 300)
>>? SUBSTR(lpszShortPath,1,lnLen)
>>lnLen = GetLongPathName(SUBSTR(lpszShortPath,1,lnLen),@lpszLongPath,300)
>>? SUBSTR(lpszLongPath,1,lnLen)
>>
Cetin

Just a reminder; this requires Win2K, Win98, WinME or WinXP; in the case of WinME and Win98, you must install the Microsoft Layer for Unicode on Windows 95/98/Me Systems, as is documented in the MSDN. In Win2K/XP environments where the full path might exceed 261 bytes, you need to use the Unicode version of the API call, and prepend the path with "\\?\" to permit the reporting of variant LFNs. In general, it's usually preferable to rely on the Unicode version, GetLongPathNameW, and use STRCONV to translate between ANSI and Unicode representations of the path for all OS versions.

There are alternative API calls to retrieve the full path name under all present Win32 OS versions as long as Shell version 4.0 or later is in use, and the Scripting.FileSystemObject from WSHoffers identical information through a COM interface rather than API calls awhich requireadditional code for string format conversion.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform