http://d.hatena.ne.jp/janus_wel/20081104/1225823130 を受けてじゃあ 1.2 用の環境を作ろうかなと思ったらすでに id:nokturnalmortum が動き出していた。速いよ。そして最後に書いてあるように 1.2 には runtimepath オプションがないので動かなかった。 2.0pre で切り替えする分には使える ( はず ) 。
1.2に無理矢理対応してみた。
前のと同様に、rc に入れればOK。
Headと公式の1.2で確認しました。
うまくいかなかったらおせーてください。
{ // プロファイル名のディレクトリがないときはコレ let defaultName = 'default'; // 1.2用のルートを設定 let vimp12root = null; { let homeDir = Cc['@mozilla.org/file/directory_service;1'] .getService(Ci.nsIProperties) .get("ProfD", Ci.nsIFile) .path; let profileName = homeDir.replace(/.*[\\\/]/, '').replace(/.+?\./, ''); let option = options.get('runtimepath'); if (option) { let root = option.get(); let runtimepath = root + '/' + profileName; if (io.getFile(runtimepath).exists()) { option.set(runtimepath); } else { option.set(root + '/' + defaultName); } } else { let root = vimp12root || ("~/" + config.name.toLowerCase() + "/"); let runtimepath = root + profileName; let dir = io.getFile(runtimepath); if (!dir.exists()) runtimepath = root + defaultName; io.getSpecialDirectory = function (directory) { let pluginDir = ioManager.getFile(ioManager.expandPath(runtimepath + "/" + directory)); return pluginDir.exists() && pluginDir.isDirectory() ? pluginDir : null; }; } } }
1.2とHead で実現方法に違いがあるけど、大丈夫だよね。多分。
こういうのはプラグインというわけには行かないのがちと残念。
つーか、まともなプロファイル名取得方法は無いものか。