You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
The text was updated successfully, but these errors were encountered:
ftpd currently supports Ruby versions going back to 1.9.3. __dir__ was introduced in 2.0, I think.
Can you tell me more about the symlink? Normally, if a gem is installed, its executables should automatically be in your path, so there'd be no need to create a symlink to it.
By the way, I found that ftpdrb wasn't running correctly at all when run from an installed gem. I fixed that in 9be1d37 and that fix is in 2.0.2 which I released today.
I tried to create a symlink to ftpd/bin/ftpdrb, but this broke the relative path name loading code:
This stack overflow article suggests using
__dir__
as the equivalent ofFile.dirname(File.realpath(__FILE__))
which is precisely what's needed to compute the proper relative paths. Here's a patch:The text was updated successfully, but these errors were encountered: