Commit 0e3c2f47 authored by Bas Lijnse's avatar Bas Lijnse

Added inspection of CLEAN_HOME env variable to find iTasks SDK

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1964 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 77769888
......@@ -2,11 +2,13 @@ implementation module Engine
import StdMisc, StdArray, StdList, StdOrdList, StdTuple, StdChar, StdFile, StdBool, Func
from StdFunc import o, seqList, ::St
import Map, Time, CommandLine, Error, File, FilePath, Directory, HTTP, OSError, Text, MIME, UrlEncoding
import Map, Time, CommandLine, Environment, Error, File, FilePath, Directory, HTTP, OSError, Text, MIME, UrlEncoding
import Util, HtmlUtil
import IWorld
import WebService
CLEAN_HOME_VAR :== "CLEAN_HOME"
// The iTasks engine consist of a set of HTTP request handlers
engine :: !FilePath publish -> [(!String -> Bool,!HTTPRequest *World -> (!HTTPResponse, !*World))] | Publishable publish
engine sdkPath publishable
......@@ -151,13 +153,19 @@ determineAppName world
= ((dropExtension o dropDirectory) appPath, world)
determineSDKPath :: ![FilePath] !*World -> (!Maybe FilePath, !*World)
determineSDKPath [] world = (Nothing, world)
determineSDKPath [p:ps] world
# (mbInfo,world) = getFileInfo path world
= case mbInfo of
Ok info | info.directory = (Just path,world)
_ = determineSDKPath ps world
where
path = (p </> "iTasks-SDK")
\ No newline at end of file
determineSDKPath paths world
//Try environment var first
# (mbCleanHome,world) = getEnvironmentVariable CLEAN_HOME_VAR world
= case mbCleanHome of
Nothing = searchPaths paths world
Just cleanHome = searchPaths [cleanHome] world
where
searchPaths [] world = (Nothing, world)
searchPaths [p:ps] world
# (mbInfo,world) = getFileInfo path world
= case mbInfo of
Ok info | info.directory = (Just path,world)
_ = searchPaths ps world
where
path = (p </> "iTasks-SDK")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment