mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
working on platform classes, adding move to trash option
This commit is contained in:
@@ -24,6 +24,7 @@ package processing.app;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
@@ -142,6 +143,23 @@ public class Platform {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
|
||||
* If not possible, just deletes the file or folder instead.
|
||||
* @param file the folder or file to be removed/deleted
|
||||
* @return true if the folder was successfully removed
|
||||
* @throws IOException
|
||||
*/
|
||||
public boolean deleteFile(File file) throws IOException {
|
||||
if (file.isDirectory()) {
|
||||
Base.removeDir(file);
|
||||
} else {
|
||||
return file.delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
@@ -24,6 +24,7 @@ package processing.app.macosx;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.apple.eio.FileManager;
|
||||
|
||||
@@ -79,8 +80,8 @@ public class Platform extends processing.app.Platform {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public File getSettingsFolder() throws Exception {
|
||||
return new File(getLibraryFolder(), "Processing");
|
||||
}
|
||||
@@ -101,6 +102,15 @@ public class Platform extends processing.app.Platform {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Moves the specified File object (which might be a file or folder)
|
||||
* to the trash.
|
||||
*/
|
||||
public boolean deleteFile(File file) throws IOException {
|
||||
return FileManager.moveToTrash(file);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,15 +21,6 @@ public class Registry {
|
||||
rootKeyMap.put(REGISTRY_ROOT_KEY.USERS, WINREG.HKEY_USERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing.
|
||||
*
|
||||
* @param args arguments
|
||||
* @throws java.lang.Exception on error
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets one of the root keys.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user