Skip to content

Instantly share code, notes, and snippets.

@Slesa
Created April 24, 2017 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Slesa/960b2c61d9832eeb262067b9882c2093 to your computer and use it in GitHub Desktop.
Save Slesa/960b2c61d9832eeb262067b9882c2093 to your computer and use it in GitHub Desktop.
(* Special directory syntax:
bin\Program
bin\Application
...
bin\Config
let deployDir = "bin\deploy\"
let createZip is64bit (dirInfo: DirectoryInfo) =
let dirName = dirInfo.Name
if not (System.String.Equals(dirName, "config", System.StringComparison.CurrentCultureIgnoreCase)) then
let dirPath = dirInfo.FullName
// Configuration files
let cfgName = dirPath @@ ".." @@ "Config" @@ (dirName + ".cfg")
// Error description
let errName = dirPath @@ ".." @@ "Config" @@ (dirName + "Error.cfg")
// Extra data files
let dataMap = dict["Program", [dirPath @@ ".." @@ "data/Reboot.ini"]]
let dataFiles = if Seq.contains dirName dataMap.Keys then dataMap.Item(dirName) else List.empty
let zipName = deployDir @@ (dirName + (if is64bit then "64" else "") + ".zip")
let appFiles =
!! ( dirPath @@ "/**/*")
++ clgName
++ errName
(Seq.toList appFiles) @ dataFiles
|> Zip (dirPath @@ "..") zipName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment