diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-12-20 14:27:46 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-12-20 14:27:46 +0000 |
| commit | 565fea25c05c51f6e3d5940a55bc0c61423acc20 (patch) | |
| tree | 629150aeb60d357e07d56003680af20f0eab12f5 | |
| parent | make mmmfs contents sidenote-mds (diff) | |
| download | mmm-565fea25c05c51f6e3d5940a55bc0c61423acc20.tar.gz mmm-565fea25c05c51f6e3d5940a55bc0c61423acc20.zip | |
fix relative mmm-require/link with multiple ..
| -rw-r--r-- | mmm/mmmfs/util.moon | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/mmm/mmmfs/util.moon b/mmm/mmmfs/util.moon index 8887187..1ba5697 100644 --- a/mmm/mmmfs/util.moon +++ b/mmm/mmmfs/util.moon @@ -18,28 +18,15 @@ tourl = (path) -> assert origin, "cannot resolve relative path '#{fileder}' without origin!" fileder = "#{origin.path}/#{fileder}" - fileder = fileder\gsub '/([^/]-)/%.%./', '/' + while fileder\match '/([^/]-)/%.%./' + fileder = fileder\gsub '/([^/]-)/%.%./', '/' + if origin.path == fileder\sub 1, #origin.path assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}" else assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!" assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'" - -- if 'string' == type fileder - -- if '/' == fileder\sub 1, 1 - -- fileder = fileder\gsub '/([^/]-)/%.%./', '/' - -- assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!" - -- assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'" - -- else - -- assert origin, "cannot resolve relative path '#{fileder}' without origin!" - -- fileder = "#{origin.path}/#{fileder}" - -- fileder = fileder\gsub '/([^/]-)/%.%./', '/' - -- if origin.path == fileder\sub 1, #origin.path - -- assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}" - -- else - -- assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!" - -- assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'" - else assert fileder, "no fileder passed." |
