MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / save

Method save

src/main/java/fieldbox/boxes/plugins/Export.java:71–107  ·  view source on GitHub ↗
(String filename, String prefix)

Source from the content-addressed store, hash-verified

69 return true;
70 } finally {
71 try {
72 FieldBox.fieldBox.io.setDefaultDirectory(was);
73 } catch (IOException e) {
74 e.printStackTrace();
75 }
76 }
77 } catch (IOException e) {
78 e.printStackTrace();
79 return false;
80 }
81 }
82
83 private void save(String filename, String prefix) {
84// if (filename.endsWith(".field2"))
85 {
86
87 Log.println("io.debug", " saving .... ");
88 Map<Box, String> special = new LinkedHashMap<>();
89 special.put(root, ">>root<<");
90
91 String path = "";
92 String fn = filename;
93 if (filename.contains("/")) {
94
95 path = filename.substring(0, filename.lastIndexOf("/"));
96 fn = filename.substring(filename.lastIndexOf("/") + 1);
97 }
98
99 path = path.replace("\\\\", "/");
100 path = path.replace("\\\\", "/");
101
102 IO.Document doc = FieldBox.fieldBox.io.compileDocument(path, root, special);
103
104 boolean error = false;
105 try {
106 FieldBox.fieldBox.io.writeOutDocument(IO.WORKSPACE + "/" + path + "/" + fn, doc);
107 } catch (IOException e) {
108 e.printStackTrace();
109 Drawing.notify("Error saving " + e.getMessage(), this, 200);
110 error = true;

Callers 3

exportToNewWorkspaceMethod · 0.95
drawNowMethod · 0.45
saveAndBundleMethod · 0.45

Calls 7

printlnMethod · 0.95
notifyMethod · 0.95
replaceMethod · 0.80
compileDocumentMethod · 0.80
writeOutDocumentMethod · 0.80
putMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected