28

When browsing directories in a Windows program installed in Wine - like when opening a folder in Foobar2000 - Wine always opens the Wine explorer:

Open containing folder option in Foobar2000


The wine file manager

Is it possible to set Wine to open an Ubuntu file manager (e.g Nautilus) instead?

Jonas Czech
  • 4,017
  • 2
    You "should" be able to replace usr/bin/winefile. I haven't tested it though (and I suspect the FM you replace it with would need to accept the path as an argument). – RobotHumans Jan 24 '13 at 10:35
  • @hbdgaf - where is the line that specifies the FM in usr/bin/winefile? –  Sep 05 '13 at 07:27
  • fwiw, I believe the window in question is called the file chooser. I couldn't find anything though – user1974 Sep 09 '13 at 23:51
  • What file am I editing to change winefile? – James Aug 29 '16 at 19:18
  • @James - start your comment with "@" before the name of the user you are addressing –  Aug 31 '16 at 12:24
  • @cipricus I was addressing you, and it's your answer... – James Aug 31 '16 at 15:47
  • er, your question I mean. Sorry. @RobotHumans what file am I editing? /usr/bin/winefile takes me to the wine filebrowser – James Aug 31 '16 at 15:49
  • I was looking at a hard replace on disk. Not a file edit. I have no idea what file to change pointing to it. – RobotHumans Aug 31 '16 at 16:02
  • 1
    @RobotHumans Do you have any ideas? Or is there somewhere that the inner mechanisms of winefile will be explained? – James Aug 31 '16 at 18:34

4 Answers4

4

You can associate folders with the native file manager by saving the following as fix.reg and importing it using Wine's regedit. Make sure to back up the registry first.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\folder\shell]

[HKEY_CLASSES_ROOT\folder\shell\open]

[HKEY_CLASSES_ROOT\folder\shell\open\command] @=""C:\windows\system32\winebrowser.exe" -nohome "%1""

[-HKEY_CLASSES_ROOT\folder\shell\open\ddeexec]

This works for me to make foobar2000 open the native file manager when using 'Open Containing Folder'

samg
  • 41
4

The most promising approach seems to me to set MIME types for all files of interest. Have a look at How to associate all file types within Wine with its corresponding native application?

Other things I tried, but didn't work: /usr/bin/winefile is a simple wrapper script, you can replace or change it. For example, to use thunar as your file manager in wine, add after the #comment lines

thunar $@
exit

You can leave the rest as it is, to be able to undo your changes.

Second approach, not working: looking in system32 for winefile.exe and explorer.exe, replacing them with softlinks to thunar. Wine ignores this, even a double-click on this softlinks runs winefile instead of thunar.

It seems to me that winefile is a builtin of wine. Maybe some registry edits could change wine's behaviour.

mviereck
  • 219
  • I like this approach – RobotHumans Sep 01 '16 at 22:09
  • 3
    Unfortunately this doesn't seem to work for me - it still opens the Wine file manager when choosing "Open containing folder" or "Locate on disk" in Picasa, instead of Caja (the MATE file manager), which is what I want. Any ideas ? – Jonas Czech Sep 02 '16 at 06:04
  • @JonasCZ I found a file winefile.exe in ~/.wine/drive_c/windows/system32. I renamed it to winefile.exe.bak and did "ln -s /usr/bin/thunar ~/.wine/drive_c/windows/system32/winefile.exe". Surprisingly, it doesn't change anything. Even if I double click this link, winefile instead of thunar is starting. I suspect winefile may be a builtin of wine. – mviereck Sep 02 '16 at 15:40
  • @JonasCz Edit: There seems to be a twin of winefile.exe called explorer.exe. I did the same (replacing with link to thunar), and nothing changes. Maybe there has to be an adjustment in the registry to change the behaviour of wine in this case. – mviereck Sep 02 '16 at 16:05
  • @Lauscher that's not too surprising. See my answer. – Elder Geek Sep 04 '16 at 14:19
  • @JonasCz You said something useful. Is it ok to use winefile instead ? or some custom application? – Anwar Sep 05 '16 at 13:28
  • @Anwar, I'd like something which allows me to open files, move / copy them, and so on. Preferable a naitive file manager (such as Ubuntu's nautilus). – Jonas Czech Sep 05 '16 at 16:53
  • @JonasCz I saw you've already awarded the bounty. I was trying to suggest replacing the default wine explorer provided by Wine. also it seems you can associate native applications with individual file types, but to open a folder, that is hard even in Windows. – Anwar Sep 05 '16 at 16:55
  • @Anwar Could you add an answer briefly describing this ? – Jonas Czech Sep 05 '16 at 17:03
  • 1
    @JonasCz I couldn't manage to replace the wine explorer. I fear the explorer is from shell32.dll. But I can associate native application. Do you still suggest adding an answer? – Anwar Sep 05 '16 at 17:23
  • @JonasCz I've added an answer illustrating how you can associate a native application with a file type in WINE. – Anwar Sep 15 '16 at 18:07
  • @Anwar - what answer is that? –  Dec 09 '16 at 15:23
  • Sorry for replying so late! - Is this answer correct/confirmed? @Lauscher says he hasn't checked it before posting, comments contradict it. - @Lauscher, would you please test and confirm it works, and then post a few more lines of /usr/bin/winefile to illustrate clearly what to do? –  Dec 09 '16 at 15:38
  • @cipricus, I have tested it, but it does not seem to work. wine ignores a changed /usr/bin/winefile and it ignores softlinks to thunar replacing winefile.exe and explorer.exe. wine seems to use none of these applications. As another approach, one could run wine regedit and search for entrys related to file browsing, maybe with keywordexplorer.exe. – mviereck Dec 10 '16 at 09:29
  • 1
    @cipricus The most promising approach seems to me to set MIME types for all files of interest. Have a look at How to associate all file types within Wine with its corresponding native application? – mviereck Dec 10 '16 at 09:48
  • The linked question in your comment is very interesting. But your answer, as it stands now, if one considers it without reading the comments, may seem misleading to a newcomer, as it is saying something that is not the case. It should be edited to indicate that the most probable solution will come from the linked question: associating file-types to native applications. –  Dec 10 '16 at 13:47
  • @cipricus, I've updated my answer with the core discoverys from the comments. The time I wrote it first, the questian had a focal point on /usr/bin/winefile, but no longer now. – mviereck Dec 10 '16 at 17:40
4

In Ubuntu 14.04 and 16.04 A quick review of the code in /usr/bin/winefile indicates that the answer is no. after checking to see if it's called with a directory name it clearly is using wine to launch the file manager regardless.

Excerpt:

if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi

# finally look in PATH
exec wine "$appname" "$@"

Since wine is designed to launch Windows executables It won't launch native apps. I would assume that using wine to launch the file selection routine is necessary in order to insure that the proper parameter is passed after file selection. This opinion is purely based on logic (and the content of /usr/bin/winefile). If you have information to the contrary please comment and share.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • 1
    It seems, winefile just do the translation of application name or .exe name and handles that to wine program to do stuff with that. – Anwar Sep 15 '16 at 15:07
  • Do you think that the way Foobar2000 can open the Linux file manager qualifies as an "information to the contrary" in the sense you ask above? –  Dec 11 '16 at 12:04
  • 1
    @cipricus No I don't. If you look carefully at that answer you will note that it's calling C:\windows\system32\winebrowser.exe to display the directory called. (winebrowser.exe is clearly not a native app and is a part of the wine library – Elder Geek Dec 12 '16 at 16:20
  • So then can't you just make a script called wine that calls wine for everyting except nautilus/thunar/etc... – Dagelf Oct 15 '17 at 17:16
  • @Dagelf You could certainly try, on the flip side that could easily result in unintended consequences that would make supporting any issues you may have with wine in the future exceedingly difficult, so I wouldn't recommend that course of action. – Elder Geek Oct 16 '17 at 15:20
2

i think no. even i have use crossover with enabled "use native browser by default" it still use it's own file browser when i tried to open file from ms. word

wine file manager

Anwar
  • 76,649
caisara
  • 157
  • This might not be true. You can assign native application to wine – Anwar Sep 05 '16 at 06:23
  • @Anwar - please provide a separate answer under the question with your solution. Even a limited one will be appreciated and awarded a bounty if the case. –  Dec 09 '16 at 15:34
  • an "open/save file" dialog is very different from an "open file explorer" button. The former will open a built-in dialog while the latter simply asks the system file browser to open a location. samg's answer shows how to make wine use the linux-native file browser for "open this location" buttons/links, but I doubt it has any effect on "open/save file" dialogs. – MattSturgeon Jan 03 '22 at 07:47