回答編集履歴
2
フォルダー>ディレクトリ に統一
answer
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
- [https://gist.github.com/nanto/774684](https://gist.github.com/nanto/774684)
|
3
3
|
- [http://nanto.asablo.jp/blog/2011/01/12/5634277](http://nanto.asablo.jp/blog/2011/01/12/5634277)
|
4
4
|
|
5
|
-
chromeURLが
|
5
|
+
chromeURL が推測した「ファイル」を示すことは仕様として、[nsIURL](https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIURL) オブジェクトに```directory```プロパティがあるのでこれを利用して(複製したオブジェクトの```path```プロパティに代入して)利用します。
|
6
6
|
|
7
7
|
```JavaScript
|
8
8
|
let url = "chrome://common/content/";
|
@@ -18,4 +18,4 @@
|
|
18
18
|
let path = localURI.path;
|
19
19
|
```
|
20
20
|
|
21
|
-
これで、無事
|
21
|
+
これで、無事ディレクトリのパスを得ることが出来ました。
|
1
ソースコードを補足
answer
CHANGED
@@ -12,8 +12,8 @@
|
|
12
12
|
|
13
13
|
let nsIURI = ios.newURI(decodeURI(url), null, null);
|
14
14
|
let path = nsIURI.path;
|
15
|
-
let baseURI = nsIURI.clone().QueryInterface(Components.interfaces.nsIURL);
|
15
|
+
let baseURI = nsIURI.clone().QueryInterface(Components.interfaces.nsIURL); // <- クローンを生成して
|
16
|
-
baseURI.path = baseURI.directory;
|
16
|
+
baseURI.path = baseURI.directory; // <- ここで path に directory のパスを代入
|
17
17
|
let localURI = crs.convertChromeURL(baseURI);
|
18
18
|
let path = localURI.path;
|
19
19
|
```
|