-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I tried to create a symlink to ftpd/bin/ftpdrb, but this broke the relative path name loading code:
unless $:.include?(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../lib')
end
This stack overflow article suggests using __dir__ as the equivalent of File.dirname(File.realpath(__FILE__)) which is precisely what's needed to compute the proper relative paths. Here's a patch:
diff --git a/bin/ftpdrb b/bin/ftpdrb
index 4513597..dcd222d 100755
--- a/bin/ftpdrb
+++ b/bin/ftpdrb
@@ -2,8 +2,8 @@
#
# Ftpd is a pure Ruby FTP server library. CLI version
#
-unless $:.include?(File.dirname(__FILE__) + '/../lib')
- $:.unshift(File.dirname(__FILE__) + '/../lib')
+unless $:.include?(__dir__ + '/../lib')
+ $:.unshift(__dir__ + '/../lib')
end
require 'ftpd'
Metadata
Metadata
Assignees
Labels
No labels