Skip to content

jepath won't work with relative paths which include ".." #169

@juntuu

Description

@juntuu

The behaviour is changed when using util::remove_all_occurrences(path, "../");, which does not "back off", but only removes ..s.

jsource/jsrc/jeload.cpp

Lines 147 to 149 in 6ae660d

// remove ./ and backoff ../
util::remove_all_occurrences(path, "../");
util::remove_all_occurrences(path, "./");

This would be easiest to do with std::filesystem::path::lexically_normal.

The broken behaviour now:

Given path: "/one/two/../three/"
expected:   "/one/three/"
actual:     "/one/two/three/"

This then fails to load when given relative path with ..

$> ../build/jsrc/Debug/jconsole
Hello YouTube Viewers, all 22 of you!
ERROR   Could not open library globally: dlopen(<path to>/jsource/jsrc/build/jsrc/Debug/libj.dylib, 1): image not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions