]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/io/BamFtp_p.cpp
Added generic I/O device to BamIndex side of things
[bamtools.git] / src / api / internal / io / BamFtp_p.cpp
index 31195bd9b06f2300f569d29c2680c49e57245d56..c6d3bf8b64795e81fca3799c0e35bbecfe9549f5 100644 (file)
@@ -418,7 +418,7 @@ bool BamFtp::ReceiveReply(void) {
     return true;
 }
 
-bool BamFtp::Seek(const int64_t& position) {
+bool BamFtp::Seek(const int64_t& position, const int origin) {
 
     // if FTP device not in a valid state
     if ( !IsOpen() ) {
@@ -434,7 +434,14 @@ bool BamFtp::Seek(const int64_t& position) {
     m_commandSocket->DisconnectFromHost();
 
     // update file position & return success
-    m_filePosition = position;
+    if ( origin == SEEK_CUR )
+        m_filePosition += position;
+    else if ( origin == SEEK_SET)
+        m_filePosition = position;
+    else {
+        // TODO: set error string
+        return false;
+    }
     return true;
 }