rush icon indicating copy to clipboard operation
rush copied to clipboard

error: Significant trailing slashes - remote box uses local filesystem to get info about file!

Open al6x opened this issue 13 years ago • 0 comments

Hi Adam, thanks for another cool tool.

It seems to me that there's some strange behavior with trailing slashes. In case if you are working on remote machine, it uses local filesystem to determine whether this is file or not?! Here's the code:

...
def self.factory(full_path, box=nil)
    if full_path.tail(1) == '/'
        Rush::Dir.new(full_path, box)


    # No matter is it remote box or local, it   
    # always uses local filesystem!
    elsif File.directory?(full_path) 


        Rush::Dir.new(full_path, box)
    else
        Rush::File.new(full_path, box)
    end
end
...

Maybe it's better to use something like that?

...
def self.factory(full_path, box=nil)
    if full_path.tail(1) == '/'
        Rush::Dir.new(full_path, box)
    elsif box.host == "localhost" 
        File.directory?(full_path) ? make_dir : make_file           
    else
        RemoteFile.directory?(full_path) ? make_dir : make_file

        # or, if it's expensive to query remote PC, just return file whithout any check?
        just_make_file
    end
end
...

P.S. I think this tool deserves much more adoption, maybe some people tried but then have been stopping using it because of the need to start the rushd process. Maybe it's worth to add ability for it to works with limited functionality but without starting rushd processes?

al6x avatar Oct 08 '10 17:10 al6x