FileSystem fs = file.getFileSystem();
String text = libraryParser.getTemplate(libraryPath + "/" + src);
text = text.replaceAll(Pattern.quote("${real_name}"), realName);
text = text.replaceAll(Pattern.quote("${safe_name}"), safeName);
final String textOut = text;
fs.runAtomicAction(new FileSystem.AtomicAction() {
public void run() throws IOException {
FileLock lock = file.lock();
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(file.getOutputStream(lock)));