mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Why was I doing that, it looks bad.
This commit is contained in:
parent
d7e916e558
commit
2f3b80f251
@ -1,4 +1,5 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
@ -53,13 +54,16 @@ func (in *Index) RemoveFile(path string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
newFiles := in.Files[:0]
|
|
||||||
for _, v := range in.Files {
|
i := 0
|
||||||
if filepath.Clean(v.File) != relPath {
|
for _, file := range in.Files {
|
||||||
newFiles = append(newFiles, v)
|
if filepath.Clean(file.File) != relPath {
|
||||||
|
// Keep file, as it doesn't match
|
||||||
|
in.Files[i] = file
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.Files = newFiles
|
in.Files = in.Files[:i]
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +179,7 @@ func (in *Index) Refresh() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.Files = in.Files[:i]
|
in.Files = in.Files[:i]
|
||||||
|
|
||||||
in.resortIndex()
|
in.resortIndex()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user