Fix a windows bug, also rename Remove to Delete
This commit is contained in:
+4
-4
@@ -170,7 +170,7 @@ func doPrepareCastURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
totalObjects++
|
||||
case <-trapCh:
|
||||
session.Close() // If we are interrupted during the URL scanning, we drop the session.
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -269,17 +269,17 @@ func runCastCmd(ctx *cli.Context) {
|
||||
session.Header.CommandType = "cast"
|
||||
session.Header.RootPath, err = os.Getwd()
|
||||
if err != nil {
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
console.Fatalf("Unable to get current working folder. %s\n", err)
|
||||
}
|
||||
|
||||
// extract URLs.
|
||||
session.Header.CommandArgs, err = args2URLs(ctx.Args())
|
||||
if err != nil {
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
console.Fatalf("One or more unknown URL types found in %s. %s\n", ctx.Args(), err)
|
||||
}
|
||||
|
||||
doCastCmdSession(session)
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
}
|
||||
|
||||
+4
-4
@@ -171,7 +171,7 @@ func doPrepareCopyURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
totalObjects++
|
||||
case <-trapCh:
|
||||
session.Close() // If we are interrupted during the URL scanning, we drop the session.
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
@@ -272,17 +272,17 @@ func runCopyCmd(ctx *cli.Context) {
|
||||
session.Header.CommandType = "cp"
|
||||
session.Header.RootPath, err = os.Getwd()
|
||||
if err != nil {
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
console.Fatalf("Unable to get current working folder. %s\n", err)
|
||||
}
|
||||
|
||||
// extract URLs.
|
||||
session.Header.CommandArgs, err = args2URLs(ctx.Args())
|
||||
if err != nil {
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
console.Fatalf("One or more unknown URL types found %s. %s\n", ctx.Args(), err)
|
||||
}
|
||||
|
||||
doCopyCmdSession(session)
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
}
|
||||
|
||||
+3
-3
@@ -88,7 +88,7 @@ func clearSession(sid string) {
|
||||
if err != nil {
|
||||
console.Fatalf("Unable to load session ‘%s’, %s", sid, NewIodine(iodine.New(err, nil)))
|
||||
}
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func clearSession(sid string) {
|
||||
console.Fatalf("Unable to load session ‘%s’, %s", sid, NewIodine(iodine.New(err, nil)))
|
||||
}
|
||||
if session != nil {
|
||||
session.Remove()
|
||||
session.Delete()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func runSessionCmd(ctx *cli.Context) {
|
||||
if err != nil {
|
||||
console.Fatalf("Unable to close session file properly. %s\n", err)
|
||||
}
|
||||
err = s.Remove()
|
||||
err = s.Delete()
|
||||
if err != nil {
|
||||
console.Fatalf("Unable to clear session files properly. %s\n", err)
|
||||
}
|
||||
|
||||
+3
-3
@@ -146,12 +146,12 @@ func (s *sessionV2) Close() error {
|
||||
return qs.Save(getSessionFile(s.SessionID))
|
||||
}
|
||||
|
||||
// Remove removes all the session files.
|
||||
func (s *sessionV2) Remove() error {
|
||||
// Delete removes all the session files.
|
||||
func (s *sessionV2) Delete() error {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
err := os.Remove(getSessionDataFile(s.SessionID))
|
||||
err := os.Remove(s.DataFP.Name())
|
||||
if err != nil {
|
||||
return NewIodine(iodine.New(err, nil))
|
||||
}
|
||||
|
||||
+4
-1
@@ -47,7 +47,10 @@ func (s *CmdTestSuite) TestSession(c *C) {
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(session.SessionID, Equals, savedSession.SessionID)
|
||||
|
||||
err = session.Remove()
|
||||
err = savedSession.Close()
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = savedSession.Delete()
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user