github.com/turingchain2020/turingchain@v1.1.21/cmd/tools/tasks/check_file_existed_task.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package tasks
     6  
     7  import (
     8  	"github.com/turingchain2020/turingchain/cmd/tools/util"
     9  )
    10  
    11  // CheckFileExistedTask 检测文件是否存在
    12  type CheckFileExistedTask struct {
    13  	TaskBase
    14  	FileName string
    15  }
    16  
    17  //GetName 获取name
    18  func (c *CheckFileExistedTask) GetName() string {
    19  	return "CheckFileExistedTask"
    20  }
    21  
    22  //Execute 执行
    23  func (c *CheckFileExistedTask) Execute() error {
    24  	mlog.Info("Execute file existed task.", "file", c.FileName)
    25  	_, err := util.CheckFileExists(c.FileName)
    26  	return err
    27  }