variables.attributes = structNew(); variables.attributes.basedir = arguments.basedir; variables.attributes.urlpath = ""; variables.attributes.fileObj = createObject('java','java.io.File'); variables.attributes.fileDelim = variables.attributes.fileObj.separator; setURLPath(); var local = structNew(); if ( structKeyExists(variables.attributes, "basedir") and len(trim(variables.attributes.basedir)) ) { variables.attributes.urlpath = variables.attributes.basedir; // let's make sure we're getting an absolute url path if ( left(variables.attributes.urlpath, 1) neq "/" ) { variables.attributes.urlpath = "/" & variables.attributes.urlpath; } } else { local.basedir = expandpath("/"); local.baselen = listlen(local.basedir, variables.attributes.fileDelim); local.thispath = getDirectoryFromPath(getCurrentTemplatePath()); if ( local.baselen gt 0 ) { for ( i=1; i lte local.baselen; i=i+1 ) { local.thispath = listDeleteAt(local.thispath, 1, variables.attributes.fileDelim); }; local.thispath = listChangeDelims(local.thispath, "/", variables.attributes.fileDelim); local.thispath = "/" & local.thispath; // sometimes you get '//directory/name' so let's clean that up, just in case if ( left(local.thispath, 2) eq "//" ) { removeChars(local.thispath, 1, 1); } } else { local.thispath = ""; } variables.attributes.urlpath = local.thispath; }