MCPcopy Index your code
hub / github.com/benfry/processing4 / isReadOnly

Method isReadOnly

app/src/processing/app/Sketch.java:1641–1664  ·  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

1639 * volumes or folders without appropriate permissions.
1640 */
1641 public boolean isReadOnly() {
1642 String path = folder.getAbsolutePath();
1643 List<Mode> modes = editor.getBase().getModeList();
1644 // Make sure it's not read-only for another Mode besides this one
1645 // https://github.com/processing/processing/issues/773
1646 for (Mode mode : modes) {
1647 if (path.startsWith(mode.getExamplesFolder().getAbsolutePath()) ||
1648 path.startsWith(mode.getLibrariesFolder().getAbsolutePath())) {
1649 return true;
1650 }
1651 }
1652
1653 // Check to see if each modified code file can be written.
1654 // Note: canWrite() does not work on directories.
1655 for (int i = 0; i < codeCount; i++) {
1656 if (code[i].isModified() &&
1657 code[i].fileReadOnly() &&
1658 code[i].fileExists()) {
1659 return true;
1660 }
1661 }
1662
1663 return false;
1664 }
1665
1666
1667 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Callers 11

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

Calls 7

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

Tested by

no test coverage detected