2016-09-14 04:16:33 -07:00
|
|
|
(module BuildScript racket
|
2019-03-05 22:18:03 -08:00
|
|
|
(provide all-defined-out)
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-03-25 14:46:30 -07:00
|
|
|
(require file/zip)
|
|
|
|
(require json)
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-12-13 18:27:00 -08:00
|
|
|
(define modFolder "/data/games/factorio/mods/")
|
2018-01-19 23:15:13 -08:00
|
|
|
(define zipModFolder "/data/games/factorio2/mods/")
|
2017-03-25 14:46:30 -07:00
|
|
|
(define configuration (call-with-input-file "info.json"
|
|
|
|
(lambda (port)
|
|
|
|
(string->jsexpr (port->string port)))))
|
|
|
|
(define packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
|
2019-02-08 21:48:00 -08:00
|
|
|
"_"
|
2017-03-25 14:46:30 -07:00
|
|
|
(hash-ref configuration 'version)))
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-03-25 14:46:30 -07:00
|
|
|
(define (makeZip folder)
|
|
|
|
(let ((packagePath (string->path (string-append folder
|
|
|
|
packageName
|
|
|
|
".zip"))))
|
|
|
|
(when (file-exists? packagePath)
|
|
|
|
(delete-file packagePath)))
|
|
|
|
(zip (string-append folder
|
2019-02-08 21:48:00 -08:00
|
|
|
packageName
|
2017-03-25 14:46:30 -07:00
|
|
|
".zip")
|
|
|
|
#:path-prefix packageName
|
|
|
|
(string->path "info.json")
|
|
|
|
(string->path "control.lua")
|
|
|
|
(string->path "config.lua")
|
|
|
|
(string->path "data.lua")
|
2017-04-01 16:40:47 -07:00
|
|
|
(string->path "data-updates.lua")
|
2017-05-16 23:18:25 -07:00
|
|
|
(string->path "data-final-fixes.lua")
|
2017-03-25 14:46:30 -07:00
|
|
|
(string->path "LICENSE.md")
|
|
|
|
(string->path "tests.lua")
|
2017-12-13 18:27:00 -08:00
|
|
|
(string->path "changelog.txt")
|
2017-05-14 17:09:43 -07:00
|
|
|
(string->path "Upgrade.lua")
|
2017-04-30 00:46:04 -07:00
|
|
|
(string->path "settings.lua")
|
2017-03-25 14:46:30 -07:00
|
|
|
(string->path "README.md")
|
2019-02-27 18:53:59 -08:00
|
|
|
(string->path "thumbnail.png")
|
2017-03-25 14:46:30 -07:00
|
|
|
(string->path "NOTICE")
|
|
|
|
(string->path "libs")
|
2017-11-20 23:27:03 -08:00
|
|
|
(string->path "sounds")
|
2017-03-25 14:46:30 -07:00
|
|
|
(string->path "locale")
|
|
|
|
(string->path "graphics")
|
|
|
|
(string->path "prototypes")))
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-03-25 14:46:30 -07:00
|
|
|
(define (copyFile fileName modFolder)
|
|
|
|
(copy-file (string->path fileName)
|
|
|
|
(string->path (string-append modFolder
|
|
|
|
packageName
|
|
|
|
"/"
|
|
|
|
fileName))))
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-03-25 14:46:30 -07:00
|
|
|
(define (copyDirectory directoryName modFolder)
|
|
|
|
(copy-directory/files (string->path directoryName)
|
|
|
|
(string->path (string-append modFolder
|
|
|
|
packageName
|
|
|
|
"/"
|
|
|
|
directoryName))))
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2017-03-25 14:46:30 -07:00
|
|
|
(define (copyFiles modFolder)
|
|
|
|
(let ((packagePath (string->path (string-append modFolder
|
|
|
|
packageName))))
|
|
|
|
(when (directory-exists? packagePath)
|
|
|
|
(delete-directory/files packagePath))
|
|
|
|
(sleep 0.1)
|
|
|
|
(make-directory packagePath)
|
|
|
|
(copyFile "control.lua" modFolder)
|
|
|
|
(copyFile "config.lua" modFolder)
|
|
|
|
(copyFile "info.json" modFolder)
|
|
|
|
(copyFile "data.lua" modFolder)
|
2017-04-01 16:40:47 -07:00
|
|
|
(copyFile "data-updates.lua" modFolder)
|
2017-05-16 23:18:25 -07:00
|
|
|
(copyFile "data-final-fixes.lua" modFolder)
|
2017-04-30 00:46:04 -07:00
|
|
|
(copyFile "settings.lua" modFolder)
|
2017-12-13 18:27:00 -08:00
|
|
|
(copyFile "changelog.txt" modFolder)
|
2017-05-14 17:09:43 -07:00
|
|
|
(copyFile "Upgrade.lua" modFolder)
|
2017-03-25 14:46:30 -07:00
|
|
|
(copyFile "tests.lua" modFolder)
|
2019-02-27 18:53:59 -08:00
|
|
|
(copyFile "thumbnail.png" modFolder)
|
2017-03-25 14:46:30 -07:00
|
|
|
(copyDirectory "libs" modFolder)
|
|
|
|
(copyDirectory "locale" modFolder)
|
2017-11-20 23:27:03 -08:00
|
|
|
(copyDirectory "sounds" modFolder)
|
2017-03-25 14:46:30 -07:00
|
|
|
(copyDirectory "graphics" modFolder)
|
|
|
|
(copyDirectory "prototypes" modFolder)))
|
2018-09-25 22:14:13 -07:00
|
|
|
|
|
|
|
(define (copy)
|
|
|
|
(copyFiles modFolder))
|
|
|
|
|
|
|
|
(define (zipIt)
|
|
|
|
(makeZip modFolder))
|
2019-02-08 21:48:00 -08:00
|
|
|
|
2019-03-05 22:18:03 -08:00
|
|
|
(define (runStart)
|
|
|
|
(copyFiles modFolder)
|
2018-01-23 13:39:32 -08:00
|
|
|
;;(copyFiles zipModFolder)
|
2019-03-05 22:18:03 -08:00
|
|
|
;; (makeZip modFolder)
|
2017-12-28 21:38:10 -08:00
|
|
|
(system*/exit-code "/data/games/factorio/bin/x64/factorio")))
|