def install_local_library(path)
      src_path = path.realpath
      library_name = src_path.basename
      destination_path = library_path(library_name)

      # things get weird if the sketchbook contains the library.
      # check that first
      if destination_path.exist?
        uhoh = "There is already a library '#{library_name}' in the library directory"
        return destination_path if destination_path == src_path

        # maybe it's a symlink? that would be OK
        if destination_path.symlink?
          return destination_path if destination_path.readlink == src_path

          @last_msg = "#{uhoh} and it's not symlinked to #{src_path}"
          return nil
        end

        @last_msg = "#{uhoh}.  It may need to be removed manually."
        return nil
      end

      # install the library
      Host.symlink(src_path, destination_path)
      destination_path
    end
def install_local_library(path)
      src_path = path.realpath
      library_name = src_path.basename
      destination_path = library_path(library_name)

      # things get weird if the sketchbook contains the library.
      # check that first
      if destination_path.exist?
        uhoh = "There is already a library '#{library_name}' in the library directory"
        return destination_path if destination_path == src_path

        # maybe it's a symlink? that would be OK
        if destination_path.symlink?
          return destination_path if destination_path.readlink == src_path

          @last_msg = "#{uhoh} and it's not symlinked to #{src_path}"
          return nil
        end

        @last_msg = "#{uhoh}.  It may need to be removed manually."
        return nil
      end

      # install the library
      Host.symlink(src_path, destination_path)
      destination_path
    end
def install_local_library ( path ) src_path = path . realpath library_name = src_path . basename destination_path = library_path ( library_name ) # things get weird if the sketchbook contains the library. # check that first if destination_path . exist? uhoh = "There is already a library '#{library_name}' in the library directory" return destination_path if destination_path == src_path # maybe it's a symlink? that would be OK if destination_path . symlink? return destination_path if destination_path . readlink == src_path @last_msg = "#{uhoh} and it's not symlinked to #{src_path}" return nil end @last_msg = "#{uhoh}.  It may need to be removed manually." return nil end # install the library Host . symlink ( src_path , destination_path ) destination_path end
ensure that the given library is installed, or symlinked as appropriate
 return the path of the prepared library, or nil
 @param path [Pathname] library to use
 @return [String] the path of the installed library
ensure that the given library is installed or symlinked as appropriate return the path of the prepared library or nil