Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Support relative paths #15

Closed
Stebalien opened this issue Mar 5, 2019 · 5 comments
Closed

Support relative paths #15

Stebalien opened this issue Mar 5, 2019 · 5 comments

Comments

@Stebalien
Copy link
Member

The current path type doesn't support relative paths. I'm not sure how best to do this or even if we want to do this but, for now, symlink "targets" will have to just be arbitrary strings.

@magik6k
Copy link
Member

magik6k commented Mar 11, 2019

How about a new type:

type RelativePath interface {
  Path // Path methods resolve Base + Target

  // Target returns raw symlink target
  Target() string

  // Base return path of the symlink parent
  Base() Path
}

RelativePath.Path.String() would look roughly like this:

func (relPath *relativePath) String() string {
  if path.IsAbs(relPath.target) {
    return relPath.target
  }
  return path.Join(relPath..base, relPath.target)
}

Thoughts?

cc @warpfork

@Stebalien
Copy link
Member Author

That should cover much of it. Unfortunately, there's still the issue of absolute symlinks. The current Path system assumes that all paths have a namespace. However, a symlink could point to /usr/share/....

@magik6k
Copy link
Member

magik6k commented Mar 18, 2019

Users could just use .Target in that case. Path methods would just yield invalid paths (we should somehow make them error, but things like:

type RelativePath interface {
  Path() (Path, error)

would make the interface less convenient.)

@Stebalien
Copy link
Member Author

I agree. Really, my question is: "should Symlink.Target be a Path or just a string. I think the conclusion here is that it should just be a string.

@hacdias
Copy link
Member

hacdias commented Jun 6, 2023

This repository is no longer maintained and has been copied over to Boxo. We are now in the process of reviewing issues and PRs and moving the ones that are still relevant. This issue has been merged with a few other issues, and moved to ipfs/boxo#198.

@hacdias hacdias closed this as completed Jun 6, 2023
@hacdias hacdias closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants