Ticket 172 (TiddlySaver)

22 views
Skip to first unread message

andrewg_oz

unread,
Nov 17, 2006, 10:55:13 AM11/17/06
to TiddlyWikiDev
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) {
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

Udo Borkowski

unread,
Nov 18, 2006, 4:49:47 AM11/18/06
to Tiddly...@googlegroups.com
Many thanks, Andrew.

I updated ticket 172 accordingly and add a new ticket (http://trac.tiddlywiki.org/tiddlywiki/ticket/236) to cover the backup folders with Java issue.

Cheers,
Udo

----------
Udo Borkowski
http://www.abego-software.de



On 11/17/06, andrewg_oz <andrew....@gmail.com> wrote:

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) {
Reply all
Reply to author
Forward
0 new messages