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

Added full path for clip.exe for WSL (#125) #126

Merged
merged 2 commits into from
Aug 25, 2024
Merged

Conversation

rpop0
Copy link
Contributor

@rpop0 rpop0 commented Aug 20, 2024

As explained in issue #125 if appendWindowsPath is disabled in /etc/wsl.conf, using the clip.exe executable directly is not possible. Switching to the full path fixes this and should work in all situations, regardless of appendWindowsPath.

@laktak
Copy link
Owner

laktak commented Aug 20, 2024

Thanks for your PR but can you provide a solution that does not hard code the path? I'm not 100% sure this will not break someone's setup.

I don't have a WSL running right now but I think there is a environment variable that points to windows/system32. Can you check and use that instead?

@rpop0
Copy link
Contributor Author

rpop0 commented Aug 20, 2024

Sure, I'll look into it if there is any way to determine this path automatically, but I don't think having it hard coded is an issue.

As far as I am aware, the Windows drive is always mapped to C:\ and it seems like that's always mounted under "/mnt/c" in WSL (https://learn.microsoft.com/en-us/windows/wsl/filesystems)

@laktak
Copy link
Owner

laktak commented Aug 21, 2024

I didn't see any env variable but you could check if clip.exe is in the system path and only try the hardcoded path if this fails.

shutil.which("clip.exe") is not None

Getting the clipboard for WSL will check if clip.exe exists before just using the full path as a fallback.
@laktak
Copy link
Owner

laktak commented Aug 25, 2024

Looks good (I'll fix the formatting). Thanks!

@laktak laktak merged commit 83ac347 into laktak:master Aug 25, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants