diff --git a/checker/public.go b/checker/public.go index 02a2cc5..257a5c7 100644 --- a/checker/public.go +++ b/checker/public.go @@ -9,9 +9,9 @@ import ( ) // CreateRegistry creates an empty type registry -// - if loadDir is TruE if will load all available types +// - if loadDir is True if will load all available types // inside the local ./types folder -func CreateRegistry(loadDir bool) *TypeRegistry { +func CreateRegistry(loadDir ...string) *TypeRegistry { /* (1) Create registry */ reg := &TypeRegistry{ @@ -19,12 +19,12 @@ func CreateRegistry(loadDir bool) *TypeRegistry { } /* (2) If no default to use -> empty registry */ - if !loadDir { + if len(loadDir) < 1 { return reg } /* (3) List types */ - plugins, err := ioutil.ReadDir("./types") + plugins, err := ioutil.ReadDir(loadDir[0]) if err != nil { log.Fatal(err) } @@ -68,7 +68,7 @@ func (tr *TypeRegistry) Add(pluginName string) error { } /* (4) Try to load the plugin */ - p, err := plugin.Open(fmt.Sprintf("./types/%s", pluginName)) + p, err := plugin.Open(fmt.Sprintf(".build/type/%s", pluginName)) if err != nil { return err } diff --git a/cmd/aicra/main.go b/cmd/aicra/main.go index 96d4a03..2687b7c 100644 --- a/cmd/aicra/main.go +++ b/cmd/aicra/main.go @@ -136,14 +136,14 @@ func main() { clifmt.Title("compile default types") err = buildTypes( dtPath, - filepath.Join(projectPath, ".build/types")) + filepath.Join(projectPath, ".build/type")) if err != nil { fmt.Printf("%s compilation error: %s\n", clifmt.Warn(), err) } /* (4) Compile types */ if compileTypes { clifmt.Title("compile types") - err = buildTypes(tPath, filepath.Join(projectPath, ".build/types")) + err = buildTypes(tPath, filepath.Join(projectPath, ".build/type")) if err != nil { fmt.Printf("%s compilation error: %s\n", clifmt.Warn(), err) } diff --git a/server.go b/server.go index e2c6d19..ac2c417 100644 --- a/server.go +++ b/server.go @@ -12,11 +12,9 @@ import ( ) // Init initilises a new framework instance -// // - path is the configuration path -// // - if typeChecker is nil, defaults will be used (all *.so files -// inside ./types local directory) +// inside ./.build/types local directory) func Init(path string, typeChecker *checker.TypeRegistry) (*Server, error) { /* (1) Init instance */ @@ -39,7 +37,7 @@ func Init(path string, typeChecker *checker.TypeRegistry) (*Server, error) { } /* (4) Default registry creation */ - inst.Checker = checker.CreateRegistry(true) + inst.Checker = checker.CreateRegistry(".build/type") return inst, nil }