Skip to content

Commit e21e794

Browse files
committed
Create data folder if it does not exists yet
If the current sketch has a data folder, it tried to copy the data files to the new location. But this folder was not yet created, which resulted in trying to copy the files to a path that doesn't exists. Now the folder gets created if it does not exists. So the files can be copied.
1 parent 9d270f7 commit e21e794

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arduino-core/src/processing/app/Sketch.java

+6
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@ public void saveAs(File newFolder) throws IOException {
357357
if (getDataFolder().exists()) {
358358
System.out.println("Data folder is found and exists.");
359359
File newDataFolder = new File(newFolder, "data");
360+
// Create the data folder
361+
if (!newDataFolder.mkdirs()) {
362+
String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath());
363+
throw new IOException(msg);
364+
}
365+
// Copy the data files into the new folder
360366
FileUtils.copy(getDataFolder(), newDataFolder);
361367
}
362368

0 commit comments

Comments
 (0)