http://trac.tiddlywiki.org/tiddlywiki/ticket/172
The suggested resolution isn't quite correct (at least it didn't work
for me). The policy file requires two permission lines, one for the
main folder, and a second for all the sub-folders:
grant codeBase "file:${user.home}/My Documents/tiddlywiki-folder/*" {
permission java.io.FilePermission "${user.home}${/}My
Documents${/}tiddlywiki-folder", "read,write";
permission java.io.FilePermission "${user.home}${/}My
Documents${/}tiddlywiki-folder${/}-", "read,write";
};
Without the first permission line, the main tiddlywiki file would not
save.
I was also able to modify the file writing code in the applet to create
backup folders. New and changed lines are marked:
public int saveFile(String filename, String charset, String data) {
try {
File f = new File(filename).getCanonicalFile(); // new
f.getParentFile().mkdirs(); // new
if (charset.length() == 0) {
int e, s = 0;
BufferedWriter w = new BufferedWriter(new FileWriter(f)); //
changed
do {
e = data.indexOf('\n', s);
if (e == -1) e = data.length();
w.write(data, s, e - s);
w.newLine();
s = e + 1;
} while (s < data.length());
w.close();
return 1;
} else {
FileOutputStream o = new FileOutputStream(f); // changed
o.write(data.getBytes(charset));
o.close();
return 1;
}
} catch (Exception x) {
x.printStackTrace();
return 0;
}
}
Cheers,
Andrew
I've just noticed:
http://trac.tiddlywiki.org/tiddlywiki/ticket/172
The suggested resolution isn't quite correct (at least it didn't work
for me). The policy file requires two permission lines, one for the
main folder, and a second for all the sub-folders:
grant codeBase "file:${user.home}/My Documents/tiddlywiki-folder/*" {
permission java.io.FilePermission "${user.home}${/}My
Documents${/}tiddlywiki-folder", "read,write";
permission java.io.FilePermission "${user.home}${/}My
Documents${/}tiddlywiki-folder${/}-", "read,write";
};
Without the first permission line, the main tiddlywiki file would not
save.
I was also able to modify the file writing code in the applet to create
backup folders. New and changed lines are marked:
public int saveFile(String filename, String charset, String data) {
try {
File f = new File(filename).getCanonicalFile(); // new
f.getParentFile().mkdirs(); // new
if (charset.length () == 0) {