server: remote rootDir parameter, as it does nothing
diff --git a/client_integration_test.go b/client_integration_test.go index dd849e3..8fa7f95 100644 --- a/client_integration_test.go +++ b/client_integration_test.go
@@ -102,7 +102,6 @@ server, err := NewServer( txPipeRd, rxPipeWr, - ".", options..., ) if err != nil {
diff --git a/examples/sftp-server/main.go b/examples/sftp-server/main.go index 3304ac5..115d35c 100644 --- a/examples/sftp-server/main.go +++ b/examples/sftp-server/main.go
@@ -21,12 +21,10 @@ var ( readOnly bool debugStderr bool - rootDir string ) flag.BoolVar(&readOnly, "R", false, "read-only server") flag.BoolVar(&debugStderr, "e", false, "debug to stderr") - flag.StringVar(&rootDir, "root", "", "root directory") flag.Parse() debugStream := ioutil.Discard @@ -123,7 +121,6 @@ server, err := sftp.NewServer( channel, channel, - rootDir, sftp.WithDebug(debugStream), sftp.ReadOnly(), )
diff --git a/server.go b/server.go index 038d4e7..81b1659 100644 --- a/server.go +++ b/server.go
@@ -29,7 +29,6 @@ outMutex *sync.Mutex debugStream io.Writer readOnly bool - rootDir string lastID uint32 pktChan chan rxPacket openFiles map[string]*os.File @@ -74,26 +73,16 @@ } // NewServer creates a new Server instance around the provided streams, serving -// content from the directory specified by rootDir. Optionally, ServerOption +// content from the root of the filesystem. Optionally, ServerOption // functions may be specified to further configure the Server. // // A subsequent call to Serve() is required to begin serving files over SFTP. -func NewServer(in io.Reader, out io.WriteCloser, rootDir string, options ...ServerOption) (*Server, error) { - if rootDir == "" { - wd, err := os.Getwd() - if err != nil { - return nil, err - } - - rootDir = wd - } - +func NewServer(in io.Reader, out io.WriteCloser, options ...ServerOption) (*Server, error) { s := &Server{ in: in, out: out, outMutex: &sync.Mutex{}, debugStream: ioutil.Discard, - rootDir: rootDir, pktChan: make(chan rxPacket, sftpServerWorkerCount), openFiles: map[string]*os.File{}, openFilesLock: &sync.RWMutex{},
diff --git a/server_integration_test.go b/server_integration_test.go index 71e16b1..4d70829 100644 --- a/server_integration_test.go +++ b/server_integration_test.go
@@ -297,7 +297,6 @@ sftpServer, err := NewServer( chsvr.ch, chsvr.ch, - ".", WithDebug(sftpServerDebugStream), ) if err != nil {
diff --git a/server_standalone/main.go b/server_standalone/main.go index 7a8f602..f7fcccd 100644 --- a/server_standalone/main.go +++ b/server_standalone/main.go
@@ -30,7 +30,6 @@ svr, _ := sftp.NewServer( os.Stdin, os.Stdout, - "", sftp.WithDebug(debugStream), sftp.ReadOnly(), )