This allows splitting a filename into a basename and extension.
`FileUtils.hasExtension()` is updated to use it, in favour of the
String.split-based approached it used before.
This rationalization helps to better follow the swing abstractions
of table models and increase separation of concerns.
(WIP: ContributedPlatforms needs a similar refactoring that will be
done in the next commits)
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.
Previously, the name of this directory contained a hash of the main
sketch filename, so the same directory would be used between builds. Now
that this directory is deleted after every build, it can just use a
randomized directory name, which is what this commit does.
Addtionally, the prefix used for generating the name is changed from
"arduino_" to "arduino_modified_sketch_" to make it slightly clearer
what the directory is for (just in case it somehow survives the build,
or a user sees it during the build).
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.
Previously, this temporary copy was kept around and only deleted when
the IDE was closed. However, all files were written to it again on every
build, so keeping the old files around did not serve any real purpose.
When a file was renamed in the IDE, the original name would still be
present in the temporary copy, and could cause linker errors because
both were compiled.
This commit makes sure the temporary copy is deleted after every build,
instead of at IDE exit, which fixes this problem with renames.
When a file is deleted from the sketch, the file would also be deleted
from the temporary copy, presumably to fix this same problem for
deletes (but renames were forgotten). With this commit, this special
handling for deleting files is no longer needed, so it is removed.
This fixes#4335
The error triggered inside ContributioIndexer.mergeContributions()
while trying to remove a platform:
if (platform != null) {
targetPackage.getPlatforms().remove(platform);
}
remove() method calls ContributedPlatform.equals() to find the
element to remove but since the parentPackage fields are resolved
*after* merging contributions, the equls() method will fail with
a NullPointerException.