forked from glenux/mfm
fix: delay config file discovery
This commit is contained in:
parent
f94d0f1f39
commit
1c184a5557
1 changed files with 10 additions and 5 deletions
|
@ -25,7 +25,7 @@ module GX
|
||||||
getter home_dir : String
|
getter home_dir : String
|
||||||
property verbose : Bool
|
property verbose : Bool
|
||||||
property mode : Mode
|
property mode : Mode
|
||||||
property path : String
|
property path : String?
|
||||||
property args : AddArgs.class | DelArgs.class | NoArgs.class
|
property args : AddArgs.class | DelArgs.class | NoArgs.class
|
||||||
|
|
||||||
def initialize()
|
def initialize()
|
||||||
|
@ -37,7 +37,7 @@ module GX
|
||||||
@verbose = false
|
@verbose = false
|
||||||
@mode = Mode::Mount
|
@mode = Mode::Mount
|
||||||
@filesystems = [] of Filesystem
|
@filesystems = [] of Filesystem
|
||||||
@path = detect_config_file()
|
@path = nil
|
||||||
|
|
||||||
@args = NoArgs
|
@args = NoArgs
|
||||||
end
|
end
|
||||||
|
@ -66,13 +66,18 @@ module GX
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_from_file
|
def load_from_file
|
||||||
|
path = @path
|
||||||
|
if path.nil?
|
||||||
|
path = detect_config_file()
|
||||||
|
end
|
||||||
|
@path = path
|
||||||
@filesystems = [] of Filesystem
|
@filesystems = [] of Filesystem
|
||||||
|
|
||||||
if !File.exists? @path
|
if !File.exists? path
|
||||||
Log.error { "File #{@path} does not exist!".colorize(:red) }
|
Log.error { "File #{path} does not exist!".colorize(:red) }
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
load_filesystems(@path)
|
load_filesystems(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def load_filesystems(config_path : String)
|
private def load_filesystems(config_path : String)
|
||||||
|
|
Loading…
Reference in a new issue