Item.getLocalFileURL() -- Return a file:/// URL path to files and snapshots
This commit is contained in:
parent
064ecd17db
commit
1447b3be92
|
@ -1080,6 +1080,9 @@ Scholar.Item.prototype.getFile = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the URL string associated with a linked or imported URL
|
||||||
|
*/
|
||||||
Scholar.Item.prototype.getFileURL = function(){
|
Scholar.Item.prototype.getFileURL = function(){
|
||||||
if (!this.isFile()){
|
if (!this.isFile()){
|
||||||
throw ("getFileURL() can only be called on items of type 'file'");
|
throw ("getFileURL() can only be called on items of type 'file'");
|
||||||
|
@ -1104,6 +1107,23 @@ Scholar.Item.prototype.getFileURL = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a file:/// URL path to files and snapshots
|
||||||
|
*/
|
||||||
|
Scholar.Item.prototype.getLocalFileURL = function(){
|
||||||
|
if (!this.isFile){
|
||||||
|
throw ("getLocalFileURL() can only be called on items of type 'file'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var file = this.getFile();
|
||||||
|
|
||||||
|
var nsIFPH = Components.classes["@mozilla.org/network/protocol;1?name=file"]
|
||||||
|
.getService(Components.interfaces.nsIFileProtocolHandler);
|
||||||
|
|
||||||
|
return nsIFPH.getURLSpecFromFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the link mode of a file item
|
* Get the link mode of a file item
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user