[tools] testbot/TestAgent: Also dereference symbolic links to better find $::RootDir.

Francois Gouget fgouget at codeweavers.com
Thu Dec 17 04:53:33 CST 2020


This allows putting a symbolic link to TestAgent in $PATH.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/scripts/TestAgent | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/testbot/scripts/TestAgent b/testbot/scripts/TestAgent
index 40f443e462..10bdc63d1b 100755
--- a/testbot/scripts/TestAgent
+++ b/testbot/scripts/TestAgent
@@ -23,12 +23,10 @@ use strict;
 
 sub BEGIN
 {
-  if ($0 !~ m=^/=)
-  {
-    # Turn $0 into an absolute path so it can safely be used in @INC
-    require Cwd;
-    $0 = Cwd::cwd() . "/$0";
-  }
+  # Turn $0 into an absolute path so it can safely be used in @INC.
+  # Also dereference symbolic links to better find $::RootDir.
+  use Cwd 'abs_path';
+  $0 = abs_path($0);
   if ($0 =~ m=^(/.*)/[^/]+/[^/]+$=)
   {
     $::RootDir = $1;
-- 
2.20.1




More information about the wine-devel mailing list