Move custom emoji dir if it exists. Closes #2379

This commit is contained in:
Gabe Kangas 2022-12-09 19:50:32 -08:00
parent 61c07757b2
commit 223b6dd388
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
2 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,7 @@ func Start() error {
resetDirectories() resetDirectories()
data.PopulateDefaults() data.PopulateDefaults()
utils.MigrateCustomEmojiLocations()
if err := data.VerifySettings(); err != nil { if err := data.VerifySettings(); err != nil {
log.Error(err) log.Error(err)

23
utils/emojiMigration.go Normal file
View File

@ -0,0 +1,23 @@
package utils
import (
"path"
log "github.com/sirupsen/logrus"
)
// MigrateCustomEmojiLocations migrates custom emoji from the old location to the new location.
func MigrateCustomEmojiLocations() {
oldLocation := path.Join("webroot", "img", "emoji")
newLocation := path.Join("data", "emoji")
if !DoesFileExists(oldLocation) {
return
}
log.Println("Moving custom emoji directory from", oldLocation, "to", newLocation)
if err := Move(oldLocation, newLocation); err != nil {
log.Errorln("error moving custom emoji directory", err)
}
}