Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "save as" operation for the data folder of a sketch #6041

Merged
merged 1 commit into from
Mar 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion arduino-core/src/processing/app/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,22 @@ public void saveAs(File newFolder) throws IOException {
file.saveAs(new File(newFolder, file.getFileName()));
}

folder = newFolder;

// Copy the data folder (this may take a while.. add progress bar?)
if (getDataFolder().exists()) {
File newDataFolder = new File(newFolder, "data");
// Check if data folder exits, if not try to create the data folder
if (!newDataFolder.exists() && !newDataFolder.mkdirs()) {
String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath());
throw new IOException(msg);
}
// Copy the data files into the new folder
FileUtils.copy(getDataFolder(), newDataFolder);
}

// Change folder to the new folder
folder = newFolder;

}

/**
Expand Down