[Project_owners] cache folder

aldre dev aldredev at gmail.com
Mon Feb 12 16:22:17 PST 2007


We are reading you loud and clear

On 2/12/07, Masry Alex <masryalex at gmail.com> wrote:
>
>  did you read the code on my previous posts? is there something wrong with
> the mailing list?
> here is the code again
>
> function get_image(img){
> 	var defaulturl = 'http://site.com/'+img;
> 	var newurl = 'chrome://ext/skin/cache'+img;
> 	try{
> 		const id = "{extID}";
> 		var file = Components.classes["@mozilla.org/extensions/manager;1"]
> 					.getService(Components.interfaces.nsIExtensionManager)
> 					.getInstallLocation(id)
> 					.getItemLocation(id);
> 		file.append("chrome");
> 		file.append("skin");
> 		file.append("cache");
> 		file.append(img);
> 		if (file.exists()) return newurl;
> 		var obj_URI = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(defaulturl, null, null);
> 		var obj_Persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Components.interfaces.nsIWebBrowserPersist);
> 		var cachekey = Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString) <http://mozilla.org/supports-string;1%27%5D.createInstance%28Components.interfaces.nsISupportsString%29>;
> 		cachekey.data = defaulturl;
> 		obj_Persist.persistFlags = Components.interfaces.nsIWebBrowserPersist.PERSIST_FLAGS_FROM_CACHE | Components.interfaces.nsIWebBrowserPersist.PERSIST_FLAGS_CLEANUP_ON_FAILURE;
> 		obj_Persist.saveURI(obj_URI,cachekey,null,null,null,file);
> 		return defaulturl;
> 	}catch(e){
> 		dump(e);
> 		return defaulturl;
> 	}
> }
>
> I just need a confirm that it works fine on other OS other than windows
>
>
> eric.jung at yahoo.com wrote:
>
>  >I'm trying to link to images using chrome:// which I have to retrieve
> the ext dir not the profile dir to save images
>
>
> http://developer.mozilla.org/en/docs/Code_snippets:File_I/O#Getting_your_extension.27s_folder
>
> >save the images in the "local settings" dir - ProfLD key to the directory
> service, iirc.
> What is ProfLD? I'm only familiar with ProfD.
>
>
>
>  ------------------------------
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.orghttp://mozdev.org/mailman/listinfo/project_owners
>
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070212/76ac9269/attachment-0001.html 


More information about the Project_owners mailing list