No subject


Tue Aug 30 17:37:41 CDT 2005


'Windows' path using GetFullPathName() -- code below.

My question is how best to do the opposite -- not necessarily from a
'Windows' program.

Ex., given a path such as 'C:\PRETEST\GEM01494\GEM01494.RTF',
how do I get
'/home/justin/.cxoffice/dotwine/fake_windows/pretest/GEM01494/GEM01494.rtf'?

I currently have a 'solution' using a lookup table
{
'C:': '/home/justin/.cxoffice/dotwine/fake_windows', 
'Y:': '/home/justin', 
'Z:': '/',
}
and recursively case-insensitively comparing each remaining part of
the path with the folder contents.

My 'solution', however, breaks down when given a path such as
ex., 'C:\PROG~FBU\MICR~HFZ\TEMP~JWQ\MEMOS\Professional Memo.dot'
where the linux path for this is
'/home/justin/.cxoffice/dotwine/fake_windows/Program Files/Microsoft
Office/Templates/Memos/Professional Memo.dot'
as 'PROG~FBU' does not match 'Program Files'

<CODE>
Option Explicit

Private Declare Function GetFullPathName Lib "kernel32" _
    Alias "GetFullPathNameA" (ByVal lpFileName As String, _
    ByVal nBufferLength As Long, ByVal lpBuffer As String, _
    ByVal lpFilePart As String) As Long

Sub test()

Dim buff As String
Dim ret As Long
Dim pth As String

pth = "/home/justin/.cxoffice/dotwine/fake_windows/pretest/GEM01494/GEM01494.rtf"

buff = Space$(1024)
ret = GetFullPathName(pth, 1024, buff, "")
buff = Left$(buff, ret)
Debug.Print ">>>" & buff & "<<<"

End Sub
</CODE>

<OUTPUT>
>>>C:\PRETEST\GEM01494\GEM01494.RTF<<<
</OUTPUT>

<MACHINE>
Mandrakelinux 10.0
Wine 20040213
Microsoft Word 97
</MACHINE>

Thank you.



More information about the wine-users mailing list