file move or copy and send notify
()
| 145 | |
| 146 | // file move or copy and send notify |
| 147 | func CheckFileStatus() { |
| 148 | for { |
| 149 | if len(OpStrArr) == 0 { |
| 150 | return |
| 151 | } |
| 152 | for _, v := range OpStrArr { |
| 153 | var total int64 = 0 |
| 154 | item, ok := FileQueue.Load(v) |
| 155 | if !ok { |
| 156 | continue |
| 157 | } |
| 158 | temp := item.(model.FileOperate) |
| 159 | for i := 0; i < len(temp.Item); i++ { |
| 160 | if !temp.Item[i].Finished { |
| 161 | size, err := file.GetFileOrDirSize(temp.To + "/" + filepath.Base(temp.Item[i].From)) |
| 162 | if err != nil { |
| 163 | continue |
| 164 | } |
| 165 | temp.Item[i].ProcessedSize = size |
| 166 | if size == temp.Item[i].Size { |
| 167 | temp.Item[i].Finished = true |
| 168 | } |
| 169 | total += size |
| 170 | } else { |
| 171 | total += temp.Item[i].ProcessedSize |
| 172 | } |
| 173 | } |
| 174 | temp.ProcessedSize = total |
| 175 | FileQueue.Store(v, temp) |
| 176 | } |
| 177 | time.Sleep(time.Second * 3) |
| 178 | } |
| 179 | } |
| 180 | func IsMounted(path string) bool { |
| 181 | mounted, _ := mountinfo.Mounted(path) |
| 182 | if mounted { |
no test coverage detected