25 lines
459 B
Go
25 lines
459 B
Go
package server
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
|
|
"coopcloud.tech/abra/pkg/config"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// CreateServerDir creates a server directory under ~/.abra.
|
|
func CreateServerDir(serverName string) error {
|
|
serverPath := path.Join(config.ABRA_DIR, "servers", serverName)
|
|
|
|
if err := os.Mkdir(serverPath, 0755); err != nil {
|
|
if !os.IsExist(err) {
|
|
return err
|
|
}
|
|
|
|
logrus.Infof("'%s' already exists, moving on...", serverPath)
|
|
}
|
|
|
|
return nil
|
|
}
|