[Win32utils-devel] win32-dir, unicode
Heesob Park
phasis at gmail.com
Mon May 29 03:53:04 EDT 2006
Hi,
2006/5/29, Daniel Berger <djberg96 at gmail.com>:
> Heesob Park wrote:
>
> <snip>
>
> > How about this?
> >
> > def GetFullPathName(file, buf_size, buf, part, utf16 = false)
> > file = multi_to_wide(file) unless utf16
> > GetFullPathNameW.call(file, buf.size/2, buf, part)
> > end
>
> Except that means adding an extra argument to a lot of methods.
>
> Hm....what about:
>
> def GetFullPathName(file, buf_size, buf, part)
> file = multi_to_wide(file) unless IsTextUnicode(file)
> GetFullPathNameW.call(file, buf.size/2, buf, part)
> end
>
> A little more work for me, but less for the user to remember.
>
That's Ok for internal Use.
But what if the user wants the result of the function ?
Every function needs to be a->w;callw;w->a; conversion like this?
def GetFullPathName(file, buf_size, buf, part)
file = multi_to_wide(file) unless IsTextUnicode(file)
GetFullPathNameW.call(file, buf.size/2, buf, part)
buf = wide_to_multi(buf)
end
I recommend to separate two functions like this:
def GetFullPathName(file, buf_size, buf, part)
GetFullPathName.call(file, buf.size/2, buf, part)
end
def GetFullPathNameW(file, buf_size, buf, part)
file = multi_to_wide(file) unless IsTextUnicode(file)
GetFullPathNameW.call(file, buf.size/2, buf, part)
end
> Will that work? Or do you think IsTextUnicode() is too unreliable?
>
I think it is a useful function.
I just don't want to make slow code with using another api function:)
Regards,
Park Heesob
More information about the win32utils-devel
mailing list