Comments (4)
There is an open issue at https://bugs.openjdk.java.net/browse/JDK-8187981 but it doesn't seem to be getting much traction. There is an alternative to System.getProperty but it's through swing:
import java.io.FileNotFoundException;
import javax.swing.filechooser.FileSystemView;
void setup() {
// Use file view to get directories
FileSystemView view = FileSystemView.getFileSystemView();
File homeDirectory = view.getHomeDirectory();
// Try writing to home directory
File testHomeFile = view.createFileObject(homeDirectory, "test_home.txt");
try {
PrintWriter writer = new PrintWriter(testHomeFile);
writer.print("test home");
writer.close();
} catch (FileNotFoundException e) {
println("File not found exception on documents.");
}
// Try writing to documents directory
File documentsDirectory = view.getChild(homeDirectory, "Documents");
File testDocumentsFile = view.createFileObject(documentsDirectory, "test_docs.txt");
try {
PrintWriter writer = new PrintWriter(testDocumentsFile);
writer.print("test documents");
writer.close();
} catch (FileNotFoundException e) {
println("File not found exception on documents.");
}
}
See https://gist.github.com/sampottinger/49aef03638b150257cca919954319f01. It does work on 10.14 with a signed application.
Open to suggestions but, unfortunately, JDK 11 isn't providing an alternative as far as I can tell? @benfry - would you like me to switch out for FileSystemView
or leave this ticket as is and address in a future JDK?
from processing4.
I think FileSystemView
would be a step backwards, so we should leave it open until we have a better fix. (Want to get AWT/Swing out of there wherever possible.)
Might be something we just need to add via JNA, since it should be a single OS call.
from processing4.
I agree. :(
from processing4.
Since this was originally posted, I've been hearing that using the name works, and the localization is handled transparently, perhaps suggesting that it's a more stable way to handle this than expected. macOS may do all sorts of “container” things behind the scenes, but it's maybe less of a concern than I originally thought.
I don't love it, but this is at least a lower priority in that case.
Also making a note in MacPlatform
to reference this issue.
from processing4.
Related Issues (20)
- .tga PImage flips y axis after save() and load()
- A problem with command-line-version processing-java.
- OSX 14.4.1 Sonoma upgrade breaks USB webcams - seems to be an issue with Java/Processing video library HOT 2
- Contribution Manager is Blank or Unable to Download Anything on Mac (Processing 4) HOT 1
- hello constructions in python HOT 1
- curveVertex() causes OutOfMemory in P2D renderer
- Flat rendering on PGraphics3D of PShapes created from PGraphics2D
- Is there any chance to build a release for Windows ARM64 platform?
- SVG Export does not match sketch HOT 1
- Add autocomplete feature to the IDE HOT 1
- performance breakpoint with strokeWeight >= 2.0 in P2D
- Resizing the sketch makes P2D / P3D freeze forever
- Provide AppImage for Linux
- Creation date updates during sketch saving (macOS)
- Reference for `Try` hangs the execution if there is no file to be loaded. HOT 1
- Manage Modes ... Blank
- Blendmode not respecting alpha in P3D under certain circumstances
- exhibhition
- Feature Request: Editor Font Size using Command + and Command - HOT 1
- Can't download Python
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from processing4.