| 1 | <!--- Work out where everything should be placed in the file system --->
|
|---|
| 2 | <!--- baseDirectory Where your code will go Eg: [D:\Inetpub\wwwroot\ScaffoldTest\ ] --->
|
|---|
| 3 | <!--- baseURL The URL for the same directory Eg: [/ScaffoldTest/ ] --->
|
|---|
| 4 | <!--- rootDirectory The web server root Eg: [D:\Inetpub\wwwroot\ ] --->
|
|---|
| 5 | <!--- thisFilePath The file path to the scaffolder Eg: [D:\Inetpub\wwwroot\scaffolder\ ] --->
|
|---|
| 6 | <!--- thisURLPath The URL path to the scaffolder Eg: [/scaffolder/ ] --->
|
|---|
| 7 | <!--- thisCFCPath The CFC path to the scaffolder Eg: [scaffolder.] --->
|
|---|
| 8 |
|
|---|
| 9 | <!--- Work out where all the generated code will go. --->
|
|---|
| 10 | <!--- If the user interface supplies these values we should use them. --->
|
|---|
| 11 | <cfif isDefined("URL.baseDirectory")>
|
|---|
| 12 | <cfset baseDirectory = URL.baseDirectory>
|
|---|
| 13 | <cfelseif isDefined("Form.baseDirectory")>
|
|---|
| 14 | <cfset baseDirectory = Form.baseDirectory>
|
|---|
| 15 | <cfelse>
|
|---|
| 16 | <cfset baseDirectory = getDirectoryFromPath(cgi.PATH_TRANSLATED)>
|
|---|
| 17 | </cfif>
|
|---|
| 18 |
|
|---|
| 19 | <cfif isDefined("URL.baseURL")>
|
|---|
| 20 | <cfset baseURL = URL.baseURL>
|
|---|
| 21 | <cfelseif isDefined("Form.baseURL")>
|
|---|
| 22 | <cfset baseURL = Form.baseURL>
|
|---|
| 23 | <cfelse>
|
|---|
| 24 | <cfset baseURL = getDirectoryFromPath(cgi.SCRIPT_NAME)>
|
|---|
| 25 | </cfif>
|
|---|
| 26 |
|
|---|
| 27 | <!--- Work out where the URL and File path match by removing matching directories until they don't match --->
|
|---|
| 28 | <cfset rootDirectory = baseDirectory>
|
|---|
| 29 | <cfset rootURL = baseURL>
|
|---|
| 30 |
|
|---|
| 31 | <cfloop from="#ListLen(baseURL,'/')#" to="1" step="-1" index="i">
|
|---|
| 32 | <cfset thisDir = ListGetAt(baseURL,i,"/")>
|
|---|
| 33 | <cfif listLast(rootDirectory,"\/") IS thisDir>
|
|---|
| 34 | <cfset rootDirectory = left(rootDirectory,(len(rootDirectory) - len(thisDir) - 1))>
|
|---|
| 35 | <cfset rootURL = left(rootURL,(len(rootURL) - len(thisDir) - 1))>
|
|---|
| 36 | </cfif>
|
|---|
| 37 | </cfloop>
|
|---|
| 38 |
|
|---|
| 39 | <!--- Work out which directory the scaffolder is located in (this template is in the same place)--->
|
|---|
| 40 | <cfset thisFilePath = getDirectoryFromPath(getCurrentTemplatePath())>
|
|---|
| 41 |
|
|---|
| 42 | <cfif Left(thisFilePath,Len(rootDirectory)) IS rootDirectory>
|
|---|
| 43 | <cfset thisURLPath = rootURL & replace(removeChars(thisFilePath, 1, Len(rootDirectory)),"\","/","all")>
|
|---|
| 44 | <cfelse>
|
|---|
| 45 | <cfset thisURLPath = rootURL & "Rubbish/">
|
|---|
| 46 | </cfif>
|
|---|
| 47 |
|
|---|
| 48 | <cfset thisCFCPath = replace(removeChars(thisURLPath,1,1),"/",".","all")>
|
|---|
| 49 |
|
|---|