Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative Symlinks #684

Closed
dwkitchen opened this issue Mar 3, 2017 · 3 comments
Closed

Relative Symlinks #684

dwkitchen opened this issue Mar 3, 2017 · 3 comments
Milestone

Comments

@dwkitchen
Copy link

dwkitchen commented Mar 3, 2017

I wanted to create Symlinks that would work on my local machine and in a VM, so I was happy to see the addition of relative symlinks.

However, I have found that the solution added in #567 does not work. The target used is relative to the root of the project folder, not relative the to the link being created.

If in this example ther is a file index.php:

<symlink link="dest" relative="true">
  <fileset dir="src">
    <include name="*" />
  </fileset>
</symlink>

The link the is created is dest/index.php -> src/index.php but this is wrong for a symlink, it should be dest/index.php -> ../src/index.php.

For relative links to work the depth of the link from the project base needs to be calculated and the correct number of ../ added to the front of target. I have created an initial WIP, but this may need more work to refine possible use cases.

@dwkitchen
Copy link
Author

As I investigate options I see that in the example in the SymlinkTask.php file is

<code>
    <symlink link="${project.basedir}/library">
        <fileset dir="/my/shared/library">
            <include name="*" />
        </fileset>
    </symlink>
</code>

The recommendation to include ${project.basedir} at the start of the link path makes this more complicated also the use of an absolute path for the source means that this would not work in my example of the symlinks working inside a VM.

I am wondering if there is already a function in the Phing dependencies that will calculate a relative path?

Is it worth adding symfony/filesystem for https://github.com/symfony/Filesystem/blob/00e0462cfe48c7fdd142d0867e827cb0d17e4e23/Filesystem.php#L327 ?

@dwkitchen dwkitchen changed the title Correcting Relative Symlinks Relative Symlinks Mar 3, 2017
@mrook
Copy link
Member

mrook commented Feb 13, 2018

#695 also tries to solve this.

@mrook
Copy link
Member

mrook commented Feb 14, 2018

Closed by merging #695.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants