diff options
author | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2024-02-26 19:20:47 -0800 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@fairlystable.org> | 2024-02-27 03:24:38 -0800 |
commit | 378924fc4f60dbc09c6eac744b1e8e68ecd488ea (patch) | |
tree | c2b9c6ef434b48675d99dc4cc85775280ff52aab /crystal/lib/bungmobott/src | |
parent | 77b74b745aaa84fe342d56f396bc0491cea0859b (diff) | |
download | twitchtools-378924fc4f60dbc09c6eac744b1e8e68ecd488ea.tar.gz twitchtools-378924fc4f60dbc09c6eac744b1e8e68ecd488ea.zip |
crystal/lib/bungmobott: define useful default config.voice_list
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 |