Alexandre Julliard : wineprefixcreate: Only create links for files that don't exist.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 24 06:45:43 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 2d3bd3e45aa2c1b30cab9e37000a9783b3a57198
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=2d3bd3e45aa2c1b30cab9e37000a9783b3a57198

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jan 24 13:43:33 2006 +0100

wineprefixcreate: Only create links for files that don't exist.
Make a copy instead of a link if the original file is writable.

---

 tools/wineprefixcreate.in |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/tools/wineprefixcreate.in b/tools/wineprefixcreate.in
index 55c4761..876a533 100644
--- a/tools/wineprefixcreate.in
+++ b/tools/wineprefixcreate.in
@@ -145,7 +145,16 @@ done
 
 link_app()
 {
-   rm -f "$2" && ln -s "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2"
+    if [ ! -f "$2" ]
+    then
+        # make a copy if the original is writable
+        if [ -w "$dlldir/$1.exe.so" ]
+        then
+            cp "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2"
+        else
+            ln -s "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2"
+        fi
+    fi
 }
 
 link_app start        "$CROOT/windows/command/start.exe"




More information about the wine-cvs mailing list