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

Moving a sketch to another folder should move all files #6404

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
import static processing.app.I18n.tr;
import static processing.app.Theme.scale;

import processing.app.helpers.FileUtils;

/**
* Main editor panel for the Processing Development Environment.
*/
Expand Down Expand Up @@ -1900,7 +1902,7 @@ protected boolean handleOpenInternal(File sketchFile) {
// copy the sketch inside
File properPdeFile = new File(properFolder, sketchFile.getName());
try {
Base.copyFile(sketchFile, properPdeFile);
FileUtils.copy(new File(sketchFile.getParent()), properFolder);
} catch (IOException e) {
Base.showWarning(tr("Error"), tr("Could not copy to a proper location."), e);
return false;
Expand Down
4 changes: 4 additions & 0 deletions arduino-core/src/processing/app/helpers/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static void copyFile(File source, File dest) throws IOException {
public static void copy(File sourceFolder, File destFolder) throws IOException {
for (File file : sourceFolder.listFiles()) {
File destFile = new File(destFolder, file.getName());
if ((destFolder.getPath().equals(file.getPath()))) {
// Avoid recursive copy of folders
continue;
}
if (file.isDirectory() && !SOURCE_CONTROL_FOLDERS.contains(file.getName())) {
if (!destFile.exists() && !destFile.mkdir()) {
throw new IOException("Unable to create folder: " + destFile);
Expand Down