RFC: Detecting the wine prefix

Paul Chitescu paulc at voip.null.ro
Fri Jul 16 03:26:57 CDT 2010


Hi!

I would want to implement a change in where the wine prefix is assumed by 
default.

The current behavior of only considering WINEPREFIX is cumbersome and risky. 
Slip a finger, forget a letter and you end running a potential disastrous 
command in the wrong prefix. I ruined my main prefix by accidenatlly running 
"winetricks ie6" in it...

To fix that I use a wrapper script (unimaginatively named "win") that detects 
the proper prefix from the current directory and calls wine or other programs 
(winecfg, wineserver, winetricks, etc.) after setting WINEPREFIX. I am 
satisfied by this wrapper but has several disadvantages:
- You need to remember to run it instead of wine.
- You may paste a command from somewhere and forget to add "win" in front.
- Needs to be distributed.

The proposed solution is to incorporate the prefix detection logic in wine 
itself so no wrapper is needed.

The modified behavior would be like this:
- If WINEPREFIX is set obey that, user knows better. This is also required to 
create a new prefix.
- Starting from current working directory descend towards root looking for a 
directory that:
	1. Has a dosdevices/ subdirectory and a system.reg file
   or
	2. Has a .wine symlink pointing to a directory matching condition 1.
   or
	3. Holds a .wine regular file whose content is the name of a directory 
matching condition 1.
- If a valid prefix (matches condition 1. above) is found use it for wine
- Else use the default ~/.wine

The extra checks 2. and 3. are to be able to handle the case when the current 
directory is on a path that is symlinked from inside the prefix. In particular 
test 3. is used when the files are on a FAT (or other symlink incapable) 
partition. I have several wine prefixes whose "Program Files" is located on a 
much larger FAT32 partition shared with you know what.

What do you think about this? Should I go on coding it?

Paul Chitescu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win
Type: application/x-shellscript
Size: 1513 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20100716/d4559169/attachment-0001.bin>


More information about the wine-devel mailing list