function writeFile(filePath, content) {
	var fileObj = new File();
	try {
		fileObj.Open(filePath, 1, 0);
		try {
			// If the string ends with a newline character:
			if(content.substr(-1) === "\n") {
				fileObj.Write(content);
			} else {
				fileObj.Write(content + "\n");
			}
		} catch(e) {
			throw "UnableToWriteFile(" + filePath + "):" + e;
		} finally {
			fileObj.Close();
		}
	} catch(e) {
		throw "FileError(" + filePath + "):" + e;
	}
}
/*
 Write the passed string to a file with specified path (overwrites existing)
*/
Write the passed string to a file with specified path (overwrites existing)
Write the passed string to a file with specified path ( overwrites existing )
function writeFile(filePath, content) {
	var fileObj = new File();
	try {
		fileObj.Open(filePath, 1, 0);
		try {
			if(content.substr(-1) === "\n") {
				fileObj.Write(content);
			} else {
				fileObj.Write(content + "\n");
			}
		} catch(e) {
			throw "UnableToWriteFile(" + filePath + "):" + e;
		} finally {
			fileObj.Close();
		}
	} catch(e) {
		throw "FileError(" + filePath + "):" + e;
	}
}
function writeFile ( filePath , content ) { var fileObj = new File ( ) ; try { fileObj . Open ( filePath , 1 , 0 ) ; try { if ( content . substr ( - 1 ) === "\n" ) { fileObj . Write ( content ) ; } else { fileObj . Write ( content + "\n" ) ; } } catch ( e ) { throw "UnableToWriteFile(" + filePath + "):" + e ; } finally { fileObj . Close ( ) ; } } catch ( e ) { throw "FileError(" + filePath + "):" + e ; } }
Write the passed string to a file with specified path (overwrites existing)
Write the passed string to a file with specified path ( overwrites existing )
// If the string ends with a newline character: