function writeFile(filePath, content) {
    var fileObj = new File();
    try {
        fileObj.Open(filePath, 1, 0);
        // If the string ends with a newline character:
        if(content.substr(-1) === "\n") {
            fileObj.Write(content);
        } else {
            fileObj.Write(content + "\n");
        }
    } catch(e) {
        // IO error
        throw "UnableToWriteFile(" + filePath + "):" + e;
    } finally {
        fileObj.Close();
    }
}
/*
 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);
        if(content.substr(-1) === "\n") {
            fileObj.Write(content);
        } else {
            fileObj.Write(content + "\n");
        }
    } catch(e) {
        throw "UnableToWriteFile(" + filePath + "):" + e;
    } finally {
        fileObj.Close();
    }
}
function writeFile ( filePath , content ) { var fileObj = new File ( ) ; try { fileObj . Open ( filePath , 1 , 0 ) ; if ( content . substr ( - 1 ) === "\n" ) { fileObj . Write ( content ) ; } else { fileObj . Write ( content + "\n" ) ; } } catch ( e ) { throw "UnableToWriteFile(" + filePath + "):" + e ; } finally { fileObj . Close ( ) ; } }
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: // IO error