Skip to content

Commit ae8c6d7

Browse files
committed
Simplified librariesmanager.Install
It does not require installLocation since it can be obtained with libPath.Parent()
1 parent efa9532 commit ae8c6d7

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Diff for: arduino/libraries/librariesmanager/install.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,8 @@ func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesinde
8181
}
8282

8383
// Install installs a library on the specified path.
84-
func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path, installLocation libraries.LibraryLocation) error {
85-
libsDir := lm.getLibrariesDir(installLocation)
86-
if libsDir == nil {
87-
return fmt.Errorf(tr("User directory not set"))
88-
}
89-
return indexLibrary.Resource.Install(lm.DownloadsDir, libsDir, libPath)
84+
func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path) error {
85+
return indexLibrary.Resource.Install(lm.DownloadsDir, libPath.Parent(), libPath)
9086
}
9187

9288
// Uninstall removes a Library

Diff for: commands/lib/install.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func installLibrary(lm *librariesmanager.LibrariesManager, libRelease *libraries
141141
taskCB(&rpc.TaskProgress{Message: tr("Replacing %[1]s with %[2]s", libReplaced, libRelease)})
142142
}
143143

144-
if err := lm.Install(libRelease, libPath, installLocation); err != nil {
144+
if err := lm.Install(libRelease, libPath); err != nil {
145145
return &arduino.FailedLibraryInstallError{Cause: err}
146146
}
147147
if libReplaced != nil && !libReplaced.InstallDir.EquivalentTo(libPath) {

0 commit comments

Comments
 (0)