diff --git a/core/core.go b/core/core.go index aefcd3a20..91f243feb 100644 --- a/core/core.go +++ b/core/core.go @@ -36,6 +36,7 @@ func Start() error { resetDirectories() data.PopulateDefaults() + utils.MigrateCustomEmojiLocations() if err := data.VerifySettings(); err != nil { log.Error(err) diff --git a/utils/emojiMigration.go b/utils/emojiMigration.go new file mode 100644 index 000000000..29700c729 --- /dev/null +++ b/utils/emojiMigration.go @@ -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) + } +}