Permalink
Browse files

The root of the app was not being used. Fixed the getDir method to us…

…e the root. Now we can run the app from other dir.
  • Loading branch information...
1 parent f27f3e8 commit 428e244e451fb5e47e1d28af1b0948ab5ed66f35 Diego Echeverri committed Dec 29, 2008
Showing with 17 additions and 11 deletions.
  1. +2 −1 Config/Master.hs
  2. +15 −10 Turbinado/Environment/CodeStore.hs
View
@@ -38,7 +38,8 @@ componentViewStub = "Turbinado/Stubs/ComponentView.hs"
componentControllerDir = "App/Components/Controllers"
componentControllerStub = "Turbinado/Stubs/ComponentController.hs"
-configDir = "Config"
+-- Not being used?
+-- configDir = "Config"
staticDirs = ["static", "tmp/cache"]
compiledDir = "tmp/compiled"
@@ -42,7 +42,7 @@ retrieveCode ct cl' = do
let (CodeStore mv) = fromJust $ getCodeStore e
path = getDir ct
cl <- do -- d <- getCurrentDirectory
- return (addExtension (joinPath $ map normalise [{- d, -} path, dropExtension $ fst cl']) "hs", snd cl')
+ return (addExtension (joinPath $ map normalise [{- d, -} path, dropExtension $ fst cl']) "hs", snd cl')
debugM $ " CodeStore : retrieveCode : loading " ++ (fst cl) ++ " - " ++ (snd cl)
cmap <- liftIO $ takeMVar mv
let c= lookup cl cmap
@@ -113,6 +113,7 @@ mergeCode ct cmap cl = do
makeCode :: (HasEnvironment m) => CodeType -> CodeMap -> CodeLocation -> [Arg] -> FilePath -> m CodeMap
makeCode ct cmap cl args fp = do
ms <- liftIO $ makeAll fp (compileArgs++args)
+ debugM ("\tMaking: " ++ (fp))
case ms of
MakeFailure err -> do debugM ("\tMake error : " ++ (show err))
return (insert cl (CodeLoadFailure $ unlines err) cmap)
@@ -168,10 +169,12 @@ customMergeToDir :: (HasEnvironment m) => FilePath -> FilePath -> FilePath -> m
customMergeToDir stb src dir = do
src_exists <- liftIO $ doesFileExist src
stb_exists <- liftIO $ doesFileExist stb
- let outFile = joinPath [dir, src]
+ debugM $ "\tMerging': " ++ (show [dir, makeRelative rootDir src])
+ let src' = makeRelative rootDir src
+ outFile = joinPath [combine rootDir dir, src']
outDir = joinPath $ init $ splitDirectories outFile
- outMod = concat $ intersperse "." $ splitDirectories $ dropExtension src
- outTitle = "module " ++ outMod ++ " where \n\n"
+ outMod = concat $ intersperse "." $ splitDirectories $ dropExtension src'
+ outTitle = "module " ++ outMod ++ " where \n\n"
case (src_exists, stb_exists) of
(False, _) -> return $
MergeFailure ["Source file does not exist : "++src]
@@ -198,12 +201,14 @@ needReloadCode fp fd = do
False-> return (False, True)
getDir :: CodeType -> FilePath
-getDir ct = case ct of
- CTLayout -> layoutDir
- CTController -> controllerDir
- CTView -> viewDir
- CTComponentController -> componentControllerDir
- CTComponentView -> componentViewDir
+getDir ct =
+ let dir = case ct of
+ CTLayout -> layoutDir
+ CTController -> controllerDir
+ CTView -> viewDir
+ CTComponentController -> componentControllerDir
+ CTComponentView -> componentViewDir
+ in combine rootDir dir
getStub :: CodeType -> FilePath
getStub ct = case ct of

0 comments on commit 428e244

Please sign in to comment.