Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
193 stars 18 forks source link

Enable symlinks on Windows #548

Open jeroenpf opened 1 month ago

jeroenpf commented 1 month ago

What

In #510 we implemented support for symlinks. Unfortunately, this only works for MacOS. When running Studio on Windows, PHP WASM mounts symlink nodes with invalid target paths such as /var/www/html/C:\Users\example\target-foo - we can not mount these paths because they are not POSIX compliant.

The root cause can likely be found in Emscripten and particularly the NODEFS filesystem, which we use to mount site directories and symlink targets. Further investigation will be needed to determine the exact problem.

Creating symlinks can be done as follows: Using Windows terminal: mklink /D symlink origin_dir (for directories) mklink symlink origin_file (for files)

Using Powershell: New-Item -Path symlink -ItemType SymbolicLink -Value origin

Why

Some (Windows) developers might want to utilize symlinks to include plugins, themes, or other files located outside of their Studio project.

How

Figure out how we can fix the invalid symlink targets so that we can properly mount on it.

profucius commented 1 month ago

I too would find this extremely valuable. I have tried symbolic links, hard links, and junctions, but none of them are recognized by Wordpress within WP Studio.

My use case: I create multiple forks of sites while doing my building/testing, and to prevent copying the entire plugin/theme data every time I make a fork, a symbolic link would allow me to have a single-source of that data, which every fork would pull from.

wojtekn commented 1 month ago

Thanks for sharing your use case @profucius . I agree it's a valuable feature, and we will look for a way to add it to Windows, too.