mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-04 22:20:20 +09:00
Add param to InitRuntimeFiles() to init built-in files only
This commit is contained in:
@@ -254,7 +254,7 @@ func main() {
|
||||
screen.TermMessage(err)
|
||||
}
|
||||
|
||||
config.InitRuntimeFiles()
|
||||
config.InitRuntimeFiles(true)
|
||||
config.InitPlugins()
|
||||
|
||||
err = config.ReadSettings()
|
||||
|
||||
@@ -35,7 +35,7 @@ func startup(args []string) (tcell.SimulationScreen, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config.InitRuntimeFiles()
|
||||
config.InitRuntimeFiles(true)
|
||||
config.InitPlugins()
|
||||
|
||||
err = config.ReadSettings()
|
||||
|
||||
@@ -348,7 +348,7 @@ func reloadRuntime(reloadPlugins bool) {
|
||||
}
|
||||
}
|
||||
|
||||
config.InitRuntimeFiles()
|
||||
config.InitRuntimeFiles(true)
|
||||
|
||||
if reloadPlugins {
|
||||
config.InitPlugins()
|
||||
|
||||
@@ -20,7 +20,7 @@ type operation struct {
|
||||
|
||||
func init() {
|
||||
ulua.L = lua.NewState()
|
||||
config.InitRuntimeFiles()
|
||||
config.InitRuntimeFiles(true)
|
||||
config.InitGlobalSettings()
|
||||
config.GlobalSettings["backup"] = false
|
||||
config.GlobalSettings["fastdirty"] = true
|
||||
|
||||
@@ -20,7 +20,7 @@ func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
|
||||
} else if option == "statusline" {
|
||||
screen.Redraw()
|
||||
} else if option == "filetype" {
|
||||
config.InitRuntimeFiles()
|
||||
config.InitRuntimeFiles(true)
|
||||
err := config.ReadSettings()
|
||||
if err != nil {
|
||||
screen.TermMessage(err)
|
||||
|
||||
@@ -166,10 +166,14 @@ func ListRealRuntimeFiles(fileType RTFiletype) []RuntimeFile {
|
||||
return realFiles[fileType]
|
||||
}
|
||||
|
||||
// InitRuntimeFiles initializes all assets file and the config directory
|
||||
func InitRuntimeFiles() {
|
||||
// InitRuntimeFiles initializes all assets files and the config directory.
|
||||
// If `user` is false, InitRuntimeFiles ignores the config directory and
|
||||
// initializes asset files only.
|
||||
func InitRuntimeFiles(user bool) {
|
||||
add := func(fileType RTFiletype, dir, pattern string) {
|
||||
AddRuntimeFilesFromDirectory(fileType, filepath.Join(ConfigDir, dir), pattern)
|
||||
if user {
|
||||
AddRuntimeFilesFromDirectory(fileType, filepath.Join(ConfigDir, dir), pattern)
|
||||
}
|
||||
AddRuntimeFilesFromAssets(fileType, path.Join("runtime", dir), pattern)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
InitRuntimeFiles()
|
||||
InitRuntimeFiles(true)
|
||||
}
|
||||
|
||||
func TestAddFile(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user