Skip to content

Commit

Permalink
accurate data file suffix name
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislusf committed Dec 1, 2015
1 parent 829a267 commit 01d32d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion agent/agent_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ func (r *AgentServer) Init() (err error) {

if *r.Option.CleanRestart {
if fileInfos, err := ioutil.ReadDir(r.storageBackend.dir); err == nil {
suffix := fmt.Sprintf("-%d.dat", r.Port)
for _, fi := range fileInfos {
name := fi.Name()
if !fi.IsDir() && strings.HasSuffix(name, ".dat") {
if !fi.IsDir() && strings.HasSuffix(name, suffix) {
// println("removing old dat file:", name)
os.Remove(filepath.Join(r.storageBackend.dir, name))
}
Expand Down

0 comments on commit 01d32d7

Please sign in to comment.