Ubuntu – How to allow wine to access network shares

sambashared-folderswine

I've just installed 14.04 from scratch and made MS Word working thanks to wine (1.7.17 from ppa).

The problem is I can't access my network drive shares through wine (I'm in a Office LAN).

With the old Ubuntu 11.10 I just opened .doc files in MS Word and edited, now it seems wine can't access the samba shares that are already mounted in nautilus.

The problem seems to be related to recent changes in Ubuntu's way of mounting network shares:

the old directory: /home/*username*/.gvfs
has been replaced by: /run/user/1000/gvfs

The names of shares mounted are not readable from wine (so it is trying to open the folder directly from MS word)

Best Answer

I found a workaround.
I use 13.04 but I think is the same.
The solution is to link the GVFS folder with another name.

Create this file (gvfs-patch) in /usr/share/playonlinux/bash:

sudo -H gedit /usr/share/playonlinux/bash/gvfs-patch  
#!/bin/bash

LOGFILE=/dev/null

GVFS_HOME=/run/user/$USER/gvfs

# Create BASE folder
BASE=/tmp/POL-$USER-gvfs
if [ ! -d "$BASE" ]; then
   echo "Create BASE folder : $BASE" >> $LOGFILE
   rm -fr $BASE
   mkdir $BASE
else
   echo "BASE folder exists : $BASE" >> $LOGFILE
fi

# Clean old symbolic link
for SHARE in $(ls "$BASE"); do
   if [[ ! -e "$BASE/$SHARE" && -h "$BASE/$SHARE" ]]; then
      echo "Remove OLD share folder : $SHARE" >> /tmp/diego.txt
      rm -f "$BASE/$SHARE"
   else
      echo "Share folder valid : $SHARE" >> $LOGFILE
   fi
done

# Create symbolic link for ALL share
for SHARE in $(ls "$GVFS_HOME"); do
   NSHARE=$(echo $SHARE | sed 's/:/-/g')
   if [ ! -e "$BASE/$NSHARE" ]; then
      echo "Create share folder : $NSHARE" >> $LOGFILE
      ln -s "$GVFS_HOME/$SHARE" "$BASE/$NSHARE"
   else
      echo "Share folder valid : $BASE/$NSHARE" >> $LOGFILE
   fi
done

echo $1 | sed "s|$GVFS_HOME|$BASE|g" | sed 's/:/-/g'

Make it executable

sudo chmod +x /usr/share/playonlinux/bash/gvfs-patch  
sudo chown root.root /usr/share/playonlinux/bash/gvfs-patch  

Patch this file: /usr/share/playonlinux/bash/document_reader

sudo -H gedit /usr/share/playonlinux/bash/document_reader

At line 43 (before realpath=...) add this:

doc=$($PLAYONLINUX/bash/gvfs-patch "$doc")
Related Question