git.s-ol.nu mmm / 565fea2
fix relative mmm-require/link with multiple .. s-ol 1 year, 11 months ago
1 changed file(s) with 3 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
1717 assert origin, "cannot resolve relative path '#{fileder}' without origin!"
1818 fileder = "#{origin.path}/#{fileder}"
1919
20 fileder = fileder\gsub '/([^/]-)/%.%./', '/'
20 while fileder\match '/([^/]-)/%.%./'
21 fileder = fileder\gsub '/([^/]-)/%.%./', '/'
22
2123 if origin.path == fileder\sub 1, #origin.path
2224 assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}"
2325 else
2426 assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!"
2527 assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'"
26
27 -- if 'string' == type fileder
28 -- if '/' == fileder\sub 1, 1
29 -- fileder = fileder\gsub '/([^/]-)/%.%./', '/'
30 -- assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!"
31 -- assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'"
32 -- else
33 -- assert origin, "cannot resolve relative path '#{fileder}' without origin!"
34 -- fileder = "#{origin.path}/#{fileder}"
35 -- fileder = fileder\gsub '/([^/]-)/%.%./', '/'
36 -- if origin.path == fileder\sub 1, #origin.path
37 -- assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}"
38 -- else
39 -- assert BROWSER and BROWSER.root, "cannot resolve absolute path '#{fileder}' without BROWSER and root set!"
40 -- assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}'"
4128
4229 else
4330 assert fileder, "no fileder passed."