Prototype for URL objects. Is a kind of SerializableObject.
var local_url = new URL ("/home/bob/myfile.txt",
properties);
var ftp_url = new URL ("ftp://server/pub/thefile.txt",
properties);
path. String. Path to the file system object. It can be any
path as seen in Ellié Computing Merge (toward FTP/S sites,
to Source Code Controls, to your OS native file
system...)
properties. Object. See the Notes below.
none.
ECMerge 2.1
The URL object contains a URL or URI as usual on Internet.
Note: URL objects are so called
immutable objects (that's why all their properties are
Read-Only). It means that once constructed an URL can never be
modified, it has the advantage that such an object can then be
shared anywhere without the risk of it being altered in an
unexpected way (by a portion of code that you do not
master).
The "properties" member of a URL object and parameter in new URL( ) call follow the same convention.
The members of this object represents the options depending on the scheme of the URL (local, FTP, SCC...), they contains the value for the advanced options (as they would be by the Source and Advanced options panels of the actual source).
These objects share these members, in whichever scheme:
All the schemes which are URL based share these members (it excludes the 'simple' local file system paths):
In addition web urls support these properties (see Web Source Dialog Box for more info about each option):
"anonymous"
,
"password"
,
"private-key"
,
"agent"
. Indicates which kind of
authentication method to use.The SCC command line client plug-in support these properties (see SCC Source Dialog Box for more info):
Property | Description |
browser_path | String. Read-Only. Path as it would be provided to a browser, so as to open the item |
editable_path | String. Read-Only. Path as it appears in URL text or combo field (i.e. without authentication information) |
path | String. Read-Only. Path inside a server |
properties | Object. Read-Only. Provides information about the decomposed URL and advanced options |
title | String. Read-Only. Title for the item, generally the same as the path, but some schemes may provide something nicer |
toString
compose
contains
is_target_folder
Create a URL toward a server's root, then compose it with a sub-folder's path "pub/hello".
var my_dir = new URL ("ftp://server/");
my_dir = my_dir.compose ("pub/hello");
SerializableObject object, VFS object.
function toString ( )
returns a String
none.
URL object.
ECMerge 2.1
Returns the editable_path property, which does not contain authentication information.
Displays a message box with 'ftp://server/':
alert ( URL('ftp://login:password@server/') );
URL object
function contains ( url )
returns a Boolean
url. URL object or String. If url is a string URL (url) is called to make an URL object of it.
URL object.
ECMerge 2.1
Returns true if url is logically contained by an hypothetical folder pointed to by this object.
Displays 'true, false' by testing to containments:
alert ( URL ("c:\\temp").contains ("c:\\temp\\dir") + ", " URL ("/home/user").contains ("/home/user2") );
URL object
function compose ( sub_path )
returns a
URL object
sub_path. String. A sub-path to be composed with this URL object.
URL object.
ECMerge 2.1
Composes sub_path with the path if this URL object, builds a new URL object and returns it.
sub_path accepts the usual '.' and '..' notation to climb up the directories hierarchy.
Logs the composition of /home/user1 with ../user2 (which is /home/user2):
log ( URL("/home/user1").compose("../user2") );
URL object
function is_target_folder ( )
returns a Boolean.
none.
URL object.
ECMerge 2.1
Returns true if the file system object pointed to by this URL is a folder, false if it is file or it is not known.
Displays 'true' on a Unix platform:
alert ( URL("/").is_target_folder() );
URL object