<commit_before>/*jslint 
browser: true,
nomen: false,
debug: true,
forin: true,
undef: true,
white: false,
onevar: false 
 */
var sc, DOMParser, Titanium;
 
/**
 * the Titanium Desktop version of this platform-specific helper file 
 */

/**
 * Gets the contents of a file
 */
sc.helpers.getFileContents = function(url) {
	var f = Titanium.Filesystem.getFile(url);
	if (f.exists) {
		return f.read();
	} else {
		return false;
	}
};



/**
 * sets the file contents 
 */
sc.helpers.setFileContents = function(url, content, serialize) {
	
	if (serialize) {
		content = JSON.stringify(content);
	}
	
	sc.helpers.debug('setFileContents for '+url+ ' to "' +content+ '"');
	
	try { 
		var f = Titanium.Filesystem.getFile(url);
		f.write(content);
	}<commit_msg>throw error if file write fails<commit_after>/*jslint 
browser: true,
nomen: false,
debug: true,
forin: true,
undef: true,
white: false,
onevar: false 
 */
var sc, DOMParser, Titanium;
 
/**
 * the Titanium Desktop version of this platform-specific helper file 
 */

/**
 * Gets the contents of a file
 */
sc.helpers.getFileContents = function(url) {
	var f = Titanium.Filesystem.getFile(url);
	if (f.exists) {
		return f.read();
	} else {
		return false;
	}
};



/**
 * sets the file contents 
 */
sc.helpers.setFileContents = function(url, content, serialize) {
	
	if (serialize) {
		content = JSON.stringify(content);
	}
	
	sc.helpers.debug('setFileContents for '+url+ ' to "' +content+ '"');
	
	try { 
		var f = Titanium.Filesystem.getFile(url);
		f.write(content);
	} catch (e) {
		sch.error('There was an error setting file contents:'+e.message);
	}
{'fraction_non_alphanumeric': 0.14959652389819988, 'fraction_numerical': 0.0, 'mean_word_length': 3.658959537572254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4872670', 'n_tokens_mistral': 604, 'n_tokens_neox': 555, 'n_words': 150}