Skip to content

Commit 825103e

Browse files
committed
use dir instead of path in app.Load
1 parent 8b1426a commit 825103e

File tree

1 file changed

+10
-11
lines changed
  • internal/orchestrator/app

1 file changed

+10
-11
lines changed

internal/orchestrator/app/app.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,25 @@ type ArduinoApp struct {
3737

3838
// Load creates an App instance by reading all the files composing an app and grouping them
3939
// by file type.
40-
// TODO: use the *paths.Path as argument
41-
func Load(path *paths.Path) (ArduinoApp, error) {
42-
if path == nil {
40+
func Load(dir *paths.Path) (ArduinoApp, error) {
41+
if dir == nil {
4342
return ArduinoApp{}, errors.New("path cannot be empty")
4443
}
4544

46-
exist, err := path.IsDirCheck()
45+
exist, err := dir.IsDirCheck()
4746
if err != nil {
4847
return ArduinoApp{}, fmt.Errorf("app path is not valid: %w", err)
4948
}
5049
if !exist {
51-
return ArduinoApp{}, fmt.Errorf("app path must be a directory: %s", path)
50+
return ArduinoApp{}, fmt.Errorf("app path must be a directory: %s", dir)
5251
}
53-
path, err = path.Abs()
52+
dir, err = dir.Abs()
5453
if err != nil {
5554
return ArduinoApp{}, fmt.Errorf("cannot get absolute path for app: %w", err)
5655
}
5756

5857
app := ArduinoApp{
59-
FullPath: path,
58+
FullPath: dir,
6059
Descriptor: AppDescriptor{},
6160
}
6261

@@ -71,13 +70,13 @@ func Load(path *paths.Path) (ArduinoApp, error) {
7170
return ArduinoApp{}, errors.New("descriptor app.yaml file missing from app")
7271
}
7372

74-
if path.Join("python", "main.py").Exist() {
75-
app.MainPythonFile = path.Join("python", "main.py")
73+
if dir.Join("python", "main.py").Exist() {
74+
app.MainPythonFile = dir.Join("python", "main.py")
7675
}
7776

78-
if path.Join("sketch", "sketch.ino").Exist() {
77+
if dir.Join("sketch", "sketch.ino").Exist() {
7978
// TODO: check sketch casing?
80-
app.MainSketchPath = path.Join("sketch")
79+
app.MainSketchPath = dir.Join("sketch")
8180
}
8281

8382
if app.MainPythonFile == nil && app.MainSketchPath == nil {

0 commit comments

Comments
 (0)