diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-05-29 10:22:18 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-05-29 10:22:18 +0000 |
| commit | 9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3 (patch) | |
| tree | 027f9483cca3e3ece1f363bfebb566bbf0d5dc16 /configure.lua | |
| parent | 4f2a21ba0484b0548df5c7f9a37d2f75fffb4253 (diff) | |
| download | zcatch-9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3.tar.gz zcatch-9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3.zip | |
fixed auto configuration
Diffstat (limited to 'configure.lua')
| -rw-r--r-- | configure.lua | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/configure.lua b/configure.lua index 9df4b82d..993ed51a 100644 --- a/configure.lua +++ b/configure.lua @@ -75,6 +75,12 @@ function NewConfig(on_configured_callback) local options_func = loadfile(filename) local options_table = {} + if not options_func then + print("auto configuration", options_func) + self:Config(filename) + options_func = loadfile(filename) + end + if options_func then -- Setup the options tables for k,v in pairs(self.options) do @@ -114,6 +120,28 @@ function NewConfig(on_configured_callback) os.exit(1) end end + + config.Config = function(self, filename) + print("") + print("configuration:") + if _bam_targets[1] == "print" then + self:Load(filename) + self:Print() + print("") + print("notes:") + self:OnConfigured() + print("") + else + self:Autodetect() + print("") + print("notes:") + if self:OnConfigured() then + self:Save(filename) + end + print("") + end + + end config.Autodetect = function(self) for k,v in pairs(self.options) do @@ -138,25 +166,8 @@ function NewConfig(on_configured_callback) self:PrintHelp() os.exit(0) end - - print("") - print("configuration:") - if _bam_targets[1] == "print" then - self:Load(filename) - self:Print() - print("") - print("notes:") - self:OnConfigured() - print("") - else - self:Autodetect() - print("") - print("notes:") - if self:OnConfigured() then - self:Save(filename) - end - print("") - end + + self:Config(filename) os.exit(0) end |