From 7303db4d32d692ad329cc6c6097cb9c79962dc5e Mon Sep 17 00:00:00 2001 From: s-ol Date: Tue, 29 Oct 2019 14:19:29 +0100 Subject: fixes --- mmm/mmmfs/fileder.moon | 8 +++++++- mmm/mmmfs/plugins/code.moon | 2 +- mmm/mmmfs/stores/fs.moon | 7 +++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mmm/mmmfs/fileder.moon b/mmm/mmmfs/fileder.moon index 5b65496..9918adc 100644 --- a/mmm/mmmfs/fileder.moon +++ b/mmm/mmmfs/fileder.moon @@ -43,6 +43,12 @@ class Key __tostring: => @tostring! +-- stateless iterator for implementing __ipairs +inext = (tbl, i) -> + i += 1 + if v = tbl[i] + i, v + -- Fileder itself -- contains: -- * @facets - Facet Map (Key to Value) @@ -61,7 +67,7 @@ class Fileder __ipairs: (t) -> @load! unless @loaded - ipairs t + inext, t, 0 __index: (t, k) -> @load! unless @loaded diff --git a/mmm/mmmfs/plugins/code.moon b/mmm/mmmfs/plugins/code.moon index bd28c79..5a437b4 100644 --- a/mmm/mmmfs/plugins/code.moon +++ b/mmm/mmmfs/plugins/code.moon @@ -1,4 +1,4 @@ -import div, button from require 'mmm.dom' +import pre, div, button from require 'mmm.dom' import languages from require 'mmm.highlighting' class Editor diff --git a/mmm/mmmfs/stores/fs.moon b/mmm/mmmfs/stores/fs.moon index 8aeaf65..1e09d1d 100644 --- a/mmm/mmmfs/stores/fs.moon +++ b/mmm/mmmfs/stores/fs.moon @@ -133,17 +133,16 @@ class FSStore extends Store @log "creating facet #{path} | #{name}: #{type}" assert blob, "cant create facet without value!" - filepath = @tofp path, name, type - if lfs.attributes filepath, 'mode' - error "facet file already exists!" + filepath = @locate path, name, type + assert not filepath, "facet file already exists!" + filepath = @tofp path, name, type file = assert (io.open filepath, 'wb'), "couldn't open facet file '#{filepath}'" file\write blob file\close! remove_facet: (path, name, type) => @log "removing facet #{path} | #{name}: #{type}" - filepath = @locate path, name, type assert filepath, "couldn't locate facet!" assert os.remove filepath -- cgit v1.2.3