From 78c095c9d72174ab91c04b144aa918f74abe1732 Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Thu, 18 Apr 2024 01:25:41 +0300 Subject: [PATCH] fix(clipshot): fix the command on Windows --- clipshot.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clipshot.lua b/clipshot.lua index 670187a..153ec7b 100644 --- a/clipshot.lua +++ b/clipshot.lua @@ -17,10 +17,11 @@ local platform = mp.get_property_native('platform') if platform == 'windows' then file = os.getenv('TEMP')..'\\'..o.name cmd = { - 'cmd', '/c', string.format( - 'powershell -NoProfile -Command %q', - "Add-Type -Assembly System.Windows.Forms, System.Drawing; ".. - "[Windows.Forms.Clipboard]::SetImage([Drawing.Image]::FromFile('"..file.."'))" + 'powershell', '-NoProfile', '-Command', + 'Add-Type -Assembly System.Windows.Forms, System.Drawing;', + string.format( + "[Windows.Forms.Clipboard]::SetImage([Drawing.Image]::FromFile('%s'))", + file:gsub("'", "''") ) } elseif platform == 'darwin' then