Avatar for Username

ძიება მხარდაჭერაში

ნუ გაებმებით თაღლითების მახეში მხარდაჭერის საიტზე. აქ არასდროს მოგთხოვენ სატელეფონო ნომერზე დარეკვას, შეტყობინების გამოგზავნას ან პირადი მონაცემების გაზიარებას. გთხოვთ, გვაცნობოთ რამე საეჭვოს შემჩნევისას „დარღვევაზე მოხსენების“ მეშვეობით.

Learn More

What is the Firefox equivalent of Windows' %username%?

  • 4 პასუხი
  • 1 მომხმარებელი წააწყდა მსგავს სიძნელეს
  • 4 ნახვა
  • ბოლოს გამოეხმაურა cor-el

I'm trying to setup username variables in about:config, notably default download location and browser.cache.disk.parent_directory . When I use the standard %username% variable in these settings, Firefox interprets them literally. Does Firefox have an equivalent %username% variable?

This happened

Every time Firefox opened

== Always

I'm trying to setup username variables in about:config, notably default download location and browser.cache.disk.parent_directory . When I use the standard %username% variable in these settings, Firefox interprets them literally. Does Firefox have an equivalent %username% variable? == This happened == Every time Firefox opened == Always

ყველა პასუხი (4)

No. You do not have access to environment variables on the about:config page.

You can get that value via the Tools > Error Console if necessary. Copy and Paste this code in the Code field and click evaluate.

Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('USERNAME');

ჩასწორების თარიღი: , ავტორი: cor-el

With that code snippet, can the response be injected into the browser.cache.disk.parent_directory setting?

An extension should be able to do that quite easily.
Try this code in the Tools Error Console.
You can create an extension to make the change.

const Cc = Components.classes, Ci = Components.interfaces;
var PB = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("");
var PN = "browser.cache.disk.parent_directory";
var curVal = PB.getCharPref(PN);
var userName = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment).get('USERNAME');
newVal = curVal.replace(/%USERNAME%/i, userName);
PB.setCharPref(PN, newVal);

See also:

ჩასწორების თარიღი: , ავტორი: cor-el

By "create an extension", do you mean just paste that code into a XPI?