Skip to content

Instantly share code, notes, and snippets.

@archaelus
Created October 15, 2008 14:37
Show Gist options
  • Save archaelus/16913 to your computer and use it in GitHub Desktop.
Save archaelus/16913 to your computer and use it in GitHub Desktop.
resolve(Path) ->
filename:join(resolve(filename:split(Path), [])).
resolve([], Acc) ->
lists:reverse(Acc);
resolve([".." | Rest], [_ | Acc]) ->
resolve(Rest, Acc);
resolve([".." | Rest], []) ->
resolve(Rest, []);
resolve([This | Rest], Acc) ->
resolve(Rest, [This | Acc]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment