http://bugs.winehq.org/show_bug.cgi?id=7663
------- Additional Comments From rmh@aybabtu.com 2007-18-03 07:40 -------
You should not use malloc in Wine, wcslen and others won't work properly in Wine. Use Win32 APIs like HeapAlloc and lstrlenW instead.
Ok.
Also it looks like your code won't work if there are non-ascii characters on the command line.
Ok, then I suppose I would have to convert the string to the charset defined in Un*x locale before calling canonicalize_file_name().
Btw, I notice my use of config_dir is not very correct either, since it won't support drives that are not in a subdir of config_dir. I think I would have to check which win32 drive does the file belong to, and then check if it's fully contained in it. But then there's that "catch-all" '/' drive, which breaks this scheme.
Perhaps what we should do is checking if getcwd() is a subdir of our executable's drive; if it is then leave relative paths as-is, and otherwise convert to absolute paths?