Browse Source

Move custom emoji dir if it exists. Closes #2379

pull/2426/head
Gabe Kangas 3 years ago
parent
commit
223b6dd388
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
  1. 1
      core/core.go
  2. 23
      utils/emojiMigration.go

1
core/core.go

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

23
utils/emojiMigration.go

@ -0,0 +1,23 @@ @@ -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)
}
}
Loading…
Cancel
Save