倒腾了半天的wine,希望在linux下使用windows程序。
本想使用FoxitReader看PDF的,无奈安装好了却打不开DPF文件,网上查询说是文件关联问题,windows目录结构是用“\”,而Linux确是用"/",导致打不开文件问题。
网上找到了解决方法,使用脚本进行路径空格的转换,源码如下,无奈,有错“wine: cannot find '/home/haoxi/.wine/drive_c/Program\'”
#!/bin/bash
# this is the wrapper to launch windows foxit reader
FoxitReader_wine="/home/haoxi/.wine/drive_c/Program\ Files/Foxit\ Software/Foxit\ Reader/Foxit\ Reader.exe"
root_drive='Z:\\'
launch_param=''
for file in $@
do
# if the file path is not full path, we should expand it
if [ ! `echo $file | grep ^/` ]; then
file="$(pwd)/$file"
fi
# format path under wine (Z:\ is the root in wine)
param="${root_drive}$(echo "$file" | sed 's/\//\\/g')"
launch_param="$launch_param $param"
done
#run foxit reader in the background
wine $FoxitReader_wine $launch_param &
自己也不大懂脚本,尝试网上查了查,发现一个问题,脚本1能执行无错,而脚本2却出现同上面一样的错误。暂不理解,望指点。
也作记录,日后明白了,再作答。
脚本1:
#!/bin/sh
wine /home/haoxi/.wine/drive_c/Program\ Files/Foxit\ Software/Foxit\ Reader/Foxit\ Reader.exe
脚本2:
#!/bin/sh
FoxitReader_wine="/home/haoxi/.wine/drive_c/Program\ Files/Foxit\ Software/Foxit\ Reader/Foxit\ Reader.exe"
wine $FoxitReader_wine