mirror of
				https://codeberg.org/claui/mobile-config-firefox.git
				synced 2025-11-03 20:15:56 +00:00 
			
		
		
		
	autoconfig: move chrome_dir_init code to function
This commit is contained in:
		
							parent
							
								
									bcaa46fa09
								
							
						
					
					
						commit
						d2992be5eb
					
				
					 1 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -25,19 +25,23 @@ var g_ff_version;
 | 
			
		|||
var g_updated = false;
 | 
			
		||||
var g_fragments_cache = {}; // cache for css_file_get_fragments()
 | 
			
		||||
var g_logFileStream;
 | 
			
		||||
var g_chromeDir; // nsIFile object for the "chrome" dir in user's profile
 | 
			
		||||
 | 
			
		||||
// Create <profile>/chrome/ directory if not already present
 | 
			
		||||
var g_chromeDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
 | 
			
		||||
g_chromeDir.append("chrome");
 | 
			
		||||
if (!g_chromeDir.exists()) {
 | 
			
		||||
    g_chromeDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function write_line(ostream, line) {
 | 
			
		||||
    line = line + "\n"
 | 
			
		||||
    ostream.write(line, line.length);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Create <profile>/chrome/ directory if not already present
 | 
			
		||||
function chrome_dir_init() {
 | 
			
		||||
    g_chromeDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
 | 
			
		||||
    g_chromeDir.append("chrome");
 | 
			
		||||
    if (!g_chromeDir.exists()) {
 | 
			
		||||
        g_chromeDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function log_init() {
 | 
			
		||||
    var mode = FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_APPEND;
 | 
			
		||||
    var logFile = g_chromeDir.clone();
 | 
			
		||||
| 
						 | 
				
			
			@ -294,6 +298,7 @@ function main() {
 | 
			
		|||
    log("Done");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
chrome_dir_init();
 | 
			
		||||
log_init();
 | 
			
		||||
try {
 | 
			
		||||
    main();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue