summaryrefslogtreecommitdiff
path: root/components/storage.rb
diff options
context:
space:
mode:
Diffstat (limited to 'components/storage.rb')
-rw-r--r--components/storage.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/storage.rb b/components/storage.rb
index bdf0efe..d34dac7 100644
--- a/components/storage.rb
+++ b/components/storage.rb
@@ -29,6 +29,13 @@ module NanoBot
path
end
+ def self.cartridges_path
+ [
+ ENV.fetch('NANO_BOTS_CARTRIDGES_DIRECTORY', nil),
+ "#{user_home!.sub(%r{/$}, '')}/.local/share/nano-bots/cartridges"
+ ].uniq.filter { |path| File.directory?(path) }.compact.first
+ end
+
def self.cartridge_path(path)
partial = File.join(File.dirname(path), File.basename(path, File.extname(path)))