aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-10-29 13:19:29 +0000
committers-ol <s-ol@users.noreply.github.com>2019-10-29 13:19:29 +0000
commit7303db4d32d692ad329cc6c6097cb9c79962dc5e (patch)
tree1ba2d72b99bd967cbe7fba1da810991795dcd929
parentadd sandbox (diff)
downloadmmm-7303db4d32d692ad329cc6c6097cb9c79962dc5e.tar.gz
mmm-7303db4d32d692ad329cc6c6097cb9c79962dc5e.zip
fixes
-rw-r--r--mmm/mmmfs/fileder.moon8
-rw-r--r--mmm/mmmfs/plugins/code.moon2
-rw-r--r--mmm/mmmfs/stores/fs.moon7
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