[Project_owners] cache folder

Nickolay Ponomarev asqueella at gmail.com
Tue Feb 13 02:57:33 PST 2007


On 2/13/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?

I haven't seen it. Why do you need to link to images as chrome:// ?

Nickolay

>  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);
>  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.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>


More information about the Project_owners mailing list