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

Method isReadOnly

app/src/processing/app/Sketch.java:1550–1574  ·  view source on GitHub ↗

Returns true if this is a read-only sketch. Used for the examples directory, or when sketches are loaded from read-only volumes or folders without appropriate permissions.

()

Source from the content-addressed store, hash-verified

1548 * volumes or folders without appropriate permissions.
1549 */
1550 public boolean isReadOnly() {
1551 String apath = folder.getAbsolutePath();
1552 List<Mode> modes = editor.getBase().getModeList();
1553 // Make sure it's not read-only for another Mode besides this one
1554 // https://github.com/processing/processing/issues/773
1555 for (Mode mode : modes) {
1556 if (apath.startsWith(mode.getExamplesFolder().getAbsolutePath()) ||
1557 apath.startsWith(mode.getLibrariesFolder().getAbsolutePath())) {
1558 return true;
1559 }
1560 }
1561
1562 // check to see if each modified code file can be written to
1563 // canWrite() doesn't work on directories
1564 for (int i = 0; i < codeCount; i++) {
1565 if (code[i].isModified() &&
1566 code[i].fileReadOnly() &&
1567 code[i].fileExists()) {
1568 //System.err.println("found a read-only file " + code[i].file);
1569 return true;
1570 }
1571 }
1572
1573 return false;
1574 }
1575
1576
1577 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Callers 9

handleNewCodeMethod · 0.95
handleRenameCodeMethod · 0.95
handleDeleteCodeMethod · 0.95
saveMethod · 0.95
saveAsMethod · 0.95
handleAddFileMethod · 0.95
imageioDPIMethod · 0.80
canImportMethod · 0.80

Calls 8

startsWithMethod · 0.80
getLibrariesFolderMethod · 0.80
fileReadOnlyMethod · 0.80
getModeListMethod · 0.45
getBaseMethod · 0.45
getExamplesFolderMethod · 0.45
isModifiedMethod · 0.45
fileExistsMethod · 0.45

Tested by

no test coverage detected