(imported topic written by SystemAdmin)
So… I have some java policies that I’m appending a permission within the “grant {” section to allow the use of the system clipboard. The issue with the file is that it’s delimited by LF, not CRLF.
I was able to handle the relevance to concatenate the lines correctly and insert the line in the right spot. My only issue is recreating the file correctly. Both appendfile and createfile add a CFLF after each use. I suppose it might not hurt the policy to have a CRLF at the end, but is there a better way (aside from a sleazy trick by piping out the DOS “type” command)?
Here’s to wishing appendfile and createfile had an optional parameter to specify a EOL delimiter.
Paul
Here’s a sniplet of my action. Makes no difference if it was createfile or appendfile for this example…
createfile until END_OF_FILE
{(concatenation “%0a” of lines whose (line number of it < minimum of line numbers of lines containing “}};” whose (line number of it > (line number of line containing “grant {” of file “C:\Program Files\Java\jre6\lib\security\java.policy”)) of file “C:\Program Files\Java\jre6\lib\security\java.policy”) of file “C:\Program Files\Java\jre6\lib\security\java.policy”) & “%0a%09permission java.awt.AWTPermission %22accessClipboard%22;%0a” & (concatenation “%0a” of lines whose (line number of it >= minimum of line numbers of lines containing “}};” whose (line number of it > (line number of line containing “grant {” of file “C:\Program Files\Java\jre6\lib\security\java.policy”)) of file “C:\Program Files\Java\jre6\lib\security\java.policy”) of file “C:\Program Files\Java\jre6\lib\security\java.policy”) & “%0a”}
END_OF_FILE