windows file dialogs with unix file path

Troy Rollo wine at troy.rollo.name
Wed Apr 20 18:34:52 CDT 2005


On Thu, 21 Apr 2005 02:45, Michael Jung wrote:
> This all doesn't help a whole lot, however, if what you want is to access
> files via unix path names. The CreateFile etc. functions still do not know
> how to handle unix paths.

The context here is that WINE is being used to make a Linux version of a 
Windows app (it used to use TWINE, but for obvious reasons has to move to 
WINE). Users would prefer to see UNIX path names throughout, so that's what 
needs to be displayed.

CreateFile and such are not a problem since the app won't use them - it goes 
directly to the native RTL for those functions, and to the Windows API for 
GUI stuff.

> I thought about a per application property in the wine configuration, which
> states if an application can handle unix paths correctly. Wine's file
> functions would accept unix paths only if this property is set for the
> running application (winelib apps probably should be provided an api to
> tell wine programmatically that they know how to handle unix paths). The
> unix filesystem shell namespace extension (uuh?) would also appear only, if
> the property is set.

We toyed with this idea too, but that would break too much in WINE.

> What do you think about this idea? What is your guess about how much effort
> this would take?

There are parts of Wine that call CreateFile on files they expect to find in 
the Windows file system, so you couldn't have it as a global flag.

There are other approaches I am considering

	1. A special type of path, say '\\.\unix\/etc/passwd'. (which
	   would be case sensitive).

	2. WINE specific flags to APIs that take file names.

	3. WINE specific calls (I'm thinking of something like
	    WineCreateFileExA), with conditional code in the
	    headers causing those to be used rather than the
	    Windows ones. For example:

# ifdef WINE_NATIVE_PATHS
#  define WINELIB_NAME_AWU (func) WINELIB_NAME_AW(Wine##func)
# else
#  define WINELIB_NAME_AWU(func) WINELIB_NAME_AW(func)
# endif  /* UNICODE */

HANDLE      WINAPI 
CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
HANDLE      WINAPI 
CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
HANDLE      WINAPI 
WineCreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
HANDLE      WINAPI 
WineCreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
#define     CreateFile WINELIB_NAME_AWU(CreateFile)


Now that I think of it, a combination of (2) and (3) would probably be in 
order. The Wine* APIs could convert the file name to the special path and 
pass it off to the standard Win32 APIs.



More information about the wine-devel mailing list