MCPcopy Index your code
hub / github.com/processing/processing / createTempFile

Method createTempFile

core/src/processing/core/PApplet.java:7819–7840  ·  view source on GitHub ↗

Creates a temporary file based on the name/extension of another file and in the same parent directory. Ensures that the same extension is used (i.e. so that .gz files are gzip compressed on output) and that it's done from the same directory so that renaming the file later won't cross file system bou

(File file)

Source from the content-addressed store, hash-verified

7817 * system boundaries.
7818 */
7819 static private File createTempFile(File file) throws IOException {
7820 File parentDir = file.getParentFile();
7821 if (!parentDir.exists()) {
7822 parentDir.mkdirs();
7823 }
7824 String name = file.getName();
7825 String prefix;
7826 String suffix = null;
7827 int dot = name.lastIndexOf('.');
7828 if (dot == -1) {
7829 prefix = name;
7830 } else {
7831 // preserve the extension so that .gz works properly
7832 prefix = name.substring(0, dot);
7833 suffix = name.substring(dot);
7834 }
7835 // Prefix must be three characters
7836 if (prefix.length() < 3) {
7837 prefix += "processing";
7838 }
7839 return File.createTempFile(prefix, suffix, parentDir);
7840 }
7841
7842
7843 /**

Callers 11

saveStreamMethod · 0.95
saveBytesMethod · 0.95
JAppleMenuBarClass · 0.80
compileMethod · 0.80
saveMethod · 0.80
saveFileMethod · 0.80
createTempFolderMethod · 0.80
runMethod · 0.80
runMethod · 0.80
checkFilesMethod · 0.80

Calls 1

getNameMethod · 0.45

Tested by 1

compileMethod · 0.64