diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-10-09 11:15:23 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-10-09 11:15:23 +0000 |
| commit | 762d3a849bfc8b730a66ce0679d9190e578b96cc (patch) | |
| tree | d04af9c174fb7f8487b1c65d965930cecbd9fdc6 /build/util.moon | |
| parent | add lfs driver, spec (diff) | |
| download | mmm-762d3a849bfc8b730a66ce0679d9190e578b96cc.tar.gz mmm-762d3a849bfc8b730a66ce0679d9190e578b96cc.zip | |
thin out build folder
Diffstat (limited to 'build/util.moon')
| -rw-r--r-- | build/util.moon | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/build/util.moon b/build/util.moon deleted file mode 100644 index 92450c7..0000000 --- a/build/util.moon +++ /dev/null @@ -1,53 +0,0 @@ -require 'lfs' -import Fileder, Key from require 'mmm.mmmfs.fileder' - -get_path = (root) -> - cwd = lfs.currentdir! - path = '' - - while root\find '^%.%./' - root = root\match '^%.%./(.*)' - cwd, trimmed = cwd\match '(.*)(/[^/]+)$' - path = trimmed .. path - - path - --- split filename into dirname + basename -dir_base = (path) -> - dir, base = path\match '(.-)([^/]-)$' - if dir and #dir > 0 - dir = dir\sub 1, #dir - 1 - - dir, base - -load_tree = (store, root='') -> - fileders = setmetatable {}, - __index: (path) => - with val = Fileder {} - .path = path - rawset @, path, val - - root = fileders[root] - root.facets['name: alpha'] = '' - for fn, ft in store\list_facets root.path - val = store\load_facet root.path, fn, ft - root.facets[Key fn, ft] = val - - for path in store\list_all_fileders root.path - fileder = fileders[path] - - parent, name = dir_base path - fileder.facets['name: alpha'] = name - table.insert fileders[parent].children, fileder - - for fn, ft in store\list_facets path - val = store\load_facet path, fn, ft - fileder.facets[Key fn, ft] = val - - root - -{ - :get_path - :dir_base - :load_tree -} |
