aboutsummaryrefslogtreecommitdiff
path: root/gui/internal/model/newdir.go
blob: ec0e4f6093022266f50f7e177fe98d6016f6da51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SPDX-License-Identifier: GPL-3.0-or-later

package model

import (
	"git.labunix.xyz/krino/internal/config"
	"git.labunix.xyz/krino/internal/engine"
)

// AddDirectory writes dirs/NAME.conf from the template with path filled in
// and adds NAME to krino.conf's include - exactly what `krino new NAME
// PATH` does, through the same code, so a directory made in the window is
// indistinguishable from one made on the command line.
//
// It returns the new file's path. The caller reloads the engine: until it
// does, the window knows nothing of the new directory.
func AddDirectory(e *engine.Engine, name, path string) (string, error) {
	return config.NewDir(e.MainFile, name, path)
}