Open joshhepworth opened 9 years ago
Just figured it out. It's based on where the command to start the server is run from, so the following fixes it:
Dir.chdir(Rails.root.join("path", "to", "root")) do
# Code from the sample server here
end
I think this is worth implementing, instead of it being implicit. Thanks for the feedback!
Also, it looks like I might've gotten excited too soon. While the above will start the server in the current directory, it's not actually setting the root. A GUI program I used to test (Transmit) still shows the full path to the directory that it defaults to.
When connecting in the context of a Rails app, it seems to use the Rails.root (or perhaps the bundler root) for the root. Is there a way to explicitly define a directory to use as the root?
For example, I have some mock data that I would like to be in the SFTP server when it starts up, and I've put that in
/Users/Josh/name-of-rails-app/lib/sftp-root
, which I would like to be the root. I'm unfortunately not very familiar with libssh and haven't be able to figure it out by reading your source or the docs for libssh.Any help would be appreciated, or even just knowing if that's currently possible with this gem.