@@ -45,14 +45,14 @@ import (
45
45
func (pm * PackageManager ) LoadHardware (config * configs.Configuration ) error {
46
46
dirs , err := config .HardwareDirectories ()
47
47
if err != nil {
48
- return fmt .Errorf ("getting hardware folder : %s" , err )
48
+ return fmt .Errorf ("getting hardware directory : %s" , err )
49
49
}
50
50
if err := pm .LoadHardwareFromDirectories (dirs ); err != nil {
51
51
return err
52
52
}
53
53
dirs , err = configs .BundleToolsDirectories ()
54
54
if err != nil {
55
- return fmt .Errorf ("getting hardware folder : %s" , err )
55
+ return fmt .Errorf ("getting hardware directory : %s" , err )
56
56
}
57
57
return pm .LoadToolsFromBundleDirectories (dirs )
58
58
}
@@ -78,10 +78,10 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
78
78
if isDir , err := path .IsDir (); err != nil {
79
79
return fmt .Errorf ("reading %s stat info: %s" , path , err )
80
80
} else if ! isDir {
81
- return fmt .Errorf ("%s is not a folder " , path )
81
+ return fmt .Errorf ("%s is not a directory " , path )
82
82
}
83
83
84
- // Scan subfolders.
84
+ // Scan subdirs
85
85
files , err := path .ReadDir ()
86
86
if err != nil {
87
87
return fmt .Errorf ("reading %s directory: %s" , path , err )
@@ -90,9 +90,9 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
90
90
for _ , packagerPath := range files {
91
91
packager := packagerPath .Base ()
92
92
93
- // First exclude all "tools" folders
93
+ // First exclude all "tools" directory
94
94
if packager == "tools" {
95
- pm .Log .Infof ("Excluding folder : %s" , packagerPath )
95
+ pm .Log .Infof ("Excluding directory : %s" , packagerPath )
96
96
continue
97
97
}
98
98
@@ -102,7 +102,7 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
102
102
return fmt .Errorf ("following possible symlink %s: %s" , path , err )
103
103
}
104
104
105
- // There are two possible package folder structures:
105
+ // There are two possible package directory structures:
106
106
// - PACKAGER/ARCHITECTURE-1/boards.txt... (ex: arduino/avr/...)
107
107
// PACKAGER/ARCHITECTURE-2/boards.txt... (ex: arduino/sam/...)
108
108
// PACKAGER/ARCHITECTURE-3/boards.txt... (ex: arduino/samd/...)
@@ -111,11 +111,11 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
111
111
// PACKAGER/hardware/ARCHITECTURE-2/VERSION/boards.txt... (ex: arduino/hardware/sam/1.6.6/...)
112
112
// PACKAGER/hardware/ARCHITECTURE-3/VERSION/boards.txt... (ex: arduino/hardware/samd/1.6.12/...)
113
113
// PACKAGER/tools/... (ex: arduino/tools/...)
114
- // in the latter case we just move into "hardware" folder and continue
114
+ // in the latter case we just move into "hardware" directory and continue
115
115
var architectureParentPath * paths.Path
116
116
hardwareSubdirPath := packagerPath .Join ("hardware" ) // ex: .arduino15/packages/arduino/hardware
117
117
if isDir , _ := hardwareSubdirPath .IsDir (); isDir {
118
- // we found the "hardware" folder move down into that
118
+ // we found the "hardware" directory move down into that
119
119
architectureParentPath = hardwareSubdirPath // ex: .arduino15/packages/arduino/
120
120
} else if isDir , _ := packagerPath .IsDir (); isDir {
121
121
// we are already at the correct level
@@ -130,7 +130,7 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
130
130
return fmt .Errorf ("loading package %s: %s" , packager , err )
131
131
}
132
132
133
- // Check if we have tools to load, the folder structure is as follows:
133
+ // Check if we have tools to load, the directory structure is as follows:
134
134
// - PACKAGER/tools/TOOL-NAME/TOOL-VERSION/... (ex: arduino/tools/bossac/1.7.0/...)
135
135
toolsSubdirPath := packagerPath .Join ("tools" )
136
136
if isDir , _ := toolsSubdirPath .IsDir (); isDir {
@@ -146,18 +146,12 @@ func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) error {
146
146
147
147
// loadPlatforms load plaftorms from the specified directory assuming that they belongs
148
148
// to the targetPackage object passed as parameter.
149
- func (pm * PackageManager ) loadPlatforms (targetPackage * cores.Package , packageFolder * paths.Path ) error {
150
- pm .Log .Infof ("Loading package %s from: %s" , targetPackage .Name , packageFolder )
149
+ func (pm * PackageManager ) loadPlatforms (targetPackage * cores.Package , packageDir * paths.Path ) error {
150
+ pm .Log .Infof ("Loading package %s from: %s" , targetPackage .Name , packageDir )
151
151
152
- // packagePlatformTxt, err := properties.SafeLoad(filepath.Join(folder, constants.FILE_PLATFORM_TXT))
153
- // if err != nil {
154
- // return err
155
- // }
156
- // targetPackage.Properties.Merge(packagePlatformTxt)
157
-
158
- files , err := packageFolder .ReadDir ()
152
+ files , err := packageDir .ReadDir ()
159
153
if err != nil {
160
- return fmt .Errorf ("reading directory %s: %s" , packageFolder , err )
154
+ return fmt .Errorf ("reading directory %s: %s" , packageDir , err )
161
155
}
162
156
163
157
for _ , file := range files {
@@ -166,12 +160,12 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageFol
166
160
architecure == "platform.txt" { // TODO: Check if this "platform.txt" condition should be here....
167
161
continue
168
162
}
169
- platformPath := packageFolder .Join (architecure )
163
+ platformPath := packageDir .Join (architecure )
170
164
if isDir , _ := platformPath .IsDir (); ! isDir {
171
165
continue
172
166
}
173
167
174
- // There are two possible platform folder structures:
168
+ // There are two possible platform directory structures:
175
169
// - ARCHITECTURE/boards.txt
176
170
// - ARCHITECTURE/VERSION/boards.txt
177
171
// We identify them by checking where is the bords.txt file
@@ -202,7 +196,7 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageFol
202
196
} else /* !exist */ {
203
197
204
198
// case: ARCHITECTURE/VERSION/boards.txt
205
- // let's dive into VERSION folders
199
+ // let's dive into VERSION directories
206
200
207
201
platform := targetPackage .GetOrCreatePlatform (architecure )
208
202
versionDirs , err := platformPath .ReadDir ()
@@ -332,7 +326,6 @@ func (pm *PackageManager) loadToolReleasesFromTool(tool *cores.Tool, toolPath *p
332
326
version := versionPath .Base ()
333
327
if toolReleasePath , err := versionPath .Abs (); err == nil {
334
328
release := tool .GetOrCreateRelease (version )
335
- // TODO: Make Folder a *paths.Path
336
329
release .InstallDir = toolReleasePath
337
330
pm .Log .WithField ("tool" , release ).Infof ("Loaded tool" )
338
331
} else {
@@ -358,7 +351,7 @@ func (pm *PackageManager) LoadToolsFromBundleDirectory(toolsPath *paths.Path) er
358
351
// We scan toolsPath content to find a "builtin_tools_versions.txt", if such file exists
359
352
// then the all the tools are available in the same directory, mixed together, and their
360
353
// name and version are written in the "builtin_tools_versions.txt" file.
361
- // If no "builtin_tools_versions.txt" is found, then the folder structure is the classic
354
+ // If no "builtin_tools_versions.txt" is found, then the directory structure is the classic
362
355
// TOOLSPATH/TOOL-NAME/TOOL-VERSION and it will be parsed as such and associated to an
363
356
// "unnamed" packager.
364
357
0 commit comments