Commit b6ab17aa authored by Bas Lijnse's avatar Bas Lijnse

Merge branch 'importTextDocument' into 'master'

add importTextDocument task

See merge request !237
parents f3ca2589 14fd821a
Pipeline #20428 passed with stage
in 4 minutes and 47 seconds
definition module iTasks.Extensions.TextFile definition module iTasks.Extensions.TextFile
import iTasks import iTasks
from System.FilePath import :: FilePath from System.FilePath import :: FilePath
from iTasks.Extensions.Document import :: Document
/** /**
* Import the content of a text file on the server's filesystem. * Import the content of a text file on the server's filesystem.
...@@ -15,6 +16,16 @@ from System.FilePath import :: FilePath ...@@ -15,6 +16,16 @@ from System.FilePath import :: FilePath
*/ */
importTextFile :: !FilePath -> Task String importTextFile :: !FilePath -> Task String
/**
* Import the content of a text file document.
*
* @param Document: The document to import
*
* @return The imported content
* @throws FileException
*/
importTextDocument :: !Document -> Task String
/** /**
* Export a string as text file to the server's filesystem. * Export a string as text file to the server's filesystem.
* *
......
...@@ -9,6 +9,13 @@ importTextFile :: !FilePath -> Task String ...@@ -9,6 +9,13 @@ importTextFile :: !FilePath -> Task String
importTextFile filename = mkInstantTask eval importTextFile filename = mkInstantTask eval
where where
eval taskId iworld = fileTaskRead taskId filename readAll iworld eval taskId iworld = fileTaskRead taskId filename readAll iworld
importTextDocument :: !Document -> Task String
importTextDocument {Document|documentId} = mkInstantTask eval
where
eval taskId iworld
# (filename,iworld) = documentLocation documentId iworld
= fileTaskRead taskId filename readAll iworld
exportTextFile :: !FilePath !String -> Task String exportTextFile :: !FilePath !String -> Task String
exportTextFile filename content = mkInstantTask eval exportTextFile filename content = mkInstantTask eval
......
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