Skip to content

Commit

Permalink
Fixed issues #26 and #27
Browse files Browse the repository at this point in the history
  • Loading branch information
gholdys committed Jul 22, 2017
1 parent f85ec13 commit eef2870
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,18 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
Path dependencyFilePath = Paths.get( path );
// TODO: If the "path" string does not represent a path then it probably contains error information. Find a way to handle it.
if ( Files.exists( dependencyFilePath ) ) {
LOGGER.info( "Dependency path:" + dependencyFilePath );
Path relativeDependencyPath = librariesDir.relativize(dependencyFilePath.normalize());
String libraryName = relativeDependencyPath.getName(0).toString();
Path libraryPath = librariesDir.resolve(libraryName);
if ( !allLibraries.contains(libraryPath) ) {
LOGGER.info("Found library path: " + libraryPath);
allLibraries.add(libraryPath);
ret.add(libraryPath);
LOGGER.info( "Dependency path: " + dependencyFilePath );
if ( dependencyFilePath.startsWith( librariesDir ) ) {
Path relativeDependencyPath = librariesDir.relativize(dependencyFilePath.normalize());
String libraryName = relativeDependencyPath.getName(0).toString();
Path libraryPath = librariesDir.resolve(libraryName);
if ( !allLibraries.contains(libraryPath) ) {
LOGGER.info("Found library path: " + libraryPath);
allLibraries.add(libraryPath);
ret.add(libraryPath);
}
} else {
LOGGER.info( "Ignoring dependency file path:" + dependencyFilePath );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ public class ChipKitBoardConfigNavigator {

public static List<Path> findChipKitHardwareDirectories( ArduinoConfig arduinoPathResolver ) throws IOException {

final Path settingsPath = arduinoPathResolver.getSettingsPath();
Path settingsPath = arduinoPathResolver.getSettingsPath();

if ( settingsPath == null ) {
LOGGER.severe( "Failed to find the Arduino settings directory!" );
throw new FileNotFoundException("Failed to find the Arduino settings directory!");
}

// Find all paths containing a "platform.txt" file
LOGGER.log(Level.INFO, "Searching for platform files in {0}", settingsPath);
FileFinder finder = new FileFinder(PLATFORM_FILENAME);
Expand All @@ -65,8 +70,8 @@ public static List<Path> findChipKitHardwareDirectories( ArduinoConfig arduinoPa
if ( chipkitPlatformPaths.size() > 0 ) {
LOGGER.log(Level.INFO, "Found {0} platform path(s): {1}", new Object[]{chipkitPlatformPaths.size(), chipkitPlatformPaths});
} else {
LOGGER.severe("Failed to find any chipKIT platform file!");
throw new FileNotFoundException("Failed to find any chipKIT platform file!");
LOGGER.severe("Failed to find chipKIT platform files!");
throw new FileNotFoundException("Failed to find chipKIT platform files!");
}

return chipkitPlatformPaths;
Expand Down Expand Up @@ -122,6 +127,9 @@ public String getFullyQualifiedBoardName( String boardId ) throws IOException {
// FQBN arduino:avr:nano - [vendor folder name]:[architecture folder name]:[boardId].
// TODO: Implement proper Vendor/Architecture resolution
int chipkitIndex = findChipKitPathIndex(chipKitHardwarePath);
if ( chipkitIndex == -1 ) {
throw new RuntimeException("Failed to find chipKIT hardware directory!");
}
String chipkitCoreName = chipKitHardwarePath.getName(chipkitIndex).toString();
return chipkitCoreName + ":pic32:" + boardId;
}
Expand Down

0 comments on commit eef2870

Please sign in to comment.