diff options
Diffstat (limited to 'crystal/lib/bungmobott/src')
-rw-r--r-- | crystal/lib/bungmobott/src/bungmobott.cr | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crystal/lib/bungmobott/src/bungmobott.cr b/crystal/lib/bungmobott/src/bungmobott.cr index 3df034f..0fdb8cc 100644 --- a/crystal/lib/bungmobott/src/bungmobott.cr +++ b/crystal/lib/bungmobott/src/bungmobott.cr @@ -57,16 +57,16 @@ module BungmoBott class Config include YAML::Serializable include YAML::Serializable::Unmapped - property statedir : String = ( + property statedir : String = ( ENV["LOCALAPPDATA"]? && Path.windows( ENV["LOCALAPPDATA"] + "\\#{EXE}\\state\\" ).to_s || ENV["XDG_STATE_HOME"]? && ENV["XDG_STATE_HOME"] + "/#{EXE}/" || Path.home./(".local/state/#{EXE}").to_s ) - property tempdir : String = ( + property tempdir : String = ( ENV["TEMP"]? && ENV["TEMP"] + "\\#{EXE}\\" || "/tmp/#{EXE}/" ) - property rundir : String = ( + property rundir : String = ( ENV["XDG_RUNTIME_DIR"]? && ENV["XDG_RUNTIME_DIR"] + "/#{EXE}/" || "/tmp/#{EXE}/" ) # FIXME: do sockets and such even work on Windows? @@ -87,12 +87,13 @@ module BungmoBott @[YAML::Field(emit_null: true)] property voice_list : String? = nil -# def after_initialize() -# if @voice_list? -# # @voice_list = @statedir + "/voices.txt" -# end -# end + def after_initialize() + if @voice_list.is_a?( Nil ) + @voice_list = Path.new( @statedir, "voices.txt" ).normalize.to_s + end + end end + class Secrets include YAML::Serializable include YAML::Serializable::Unmapped |