mirror of
https://github.com/owncast/owncast.git
synced 2024-11-28 03:01:32 +03:00
Move custom emoji dir if it exists. Closes #2379
This commit is contained in:
parent
61c07757b2
commit
223b6dd388
2 changed files with 24 additions and 0 deletions
|
@ -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
23
utils/emojiMigration.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue