forked from nodoherty/ColdFusion-Koans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplication.cfc
40 lines (31 loc) · 1.15 KB
/
Application.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
component{
this.name = "ColdFusion Koans";
this.mappings["/mxunit"] = expandPath('.') & "/mxunit/";
//railo needs mappings to component dirs for calling the components from within mxunit
this.mappings["/Koans"] = expandPath('.') & "/Koans/";
this.mappings["/Components"] = expandPath('.') & "/Components/";
this.sessionmanagement = true;
this.sessiontimeout= CreateTimeSpan(0,1,0,0);
public boolean function onApplicationStart(){
application.currentDirectory = getCurrentDirectory();
if(structKeyExists(server,"coldfusion") && structKeyExists(server.coldfusion,"productversion")){
application.version = val(server.coldfusion.productversion);
}
else{
application.version = 0;
}
return true;
}
public boolean function onRequestStart(){
if(isDefined("url.reset")){
onApplicationStart();
}
return true;
}
private String function getCurrentDirectory()
output=false hint="I get the current directory name that this app is running in"{
dirs = getDirectoryFromPath(getCurrentTemplatePath());
dirs = listToArray(dirs,createObject("java","java.lang.System").getProperty("file.separator"));
return dirs[arrayLen(dirs)];
}
}