/Why Tea
dll "<kernel32.dll>"
integer proc GetShortPathName(string inpath:cstrval, var string
outpath:strptr, integer len) : "GetShortPathNameA"
end
/**************************************************************************
GetShortPathName only works for existing path's..., so create inpath if
it does not already exist.
**************************************************************************/
string proc mGetShortPathname(string inpath)
integer h, len
string short_path[_MAX_PATH_] = Format("":_MAX_PATH_:Chr(0))
h = iif(FileExists(inpath), -1, fCreate(inpath))
len = GetShortPathName(inpath, short_path, _MAX_PATH_)
if h <> -1
fClose(h)
EraseDiskFile(inpath)
endif
return (iif(len > 0, short_path[1:Pos(Chr(0), short_path) - 1], inpath))
end
string proc mGetLongPathname(string inpath)
return (ExpandPath(inpath))
end
<f3> Warn(mGetShortPathname("associations.doc"))
<f4> Warn(mGetLongPathname("associ~1.doc"))