-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcopy_plugin.cmd
More file actions
16 lines (12 loc) · 1.24 KB
/
copy_plugin.cmd
File metadata and controls
16 lines (12 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
:: %1 workspaceFolder C:\qsys_plugins\plugin
:: %2 workspaceFolderBasename plugin
FOR /F "tokens=*" %%g IN ('powershell "(new-object -COM Shell.Application).Namespace(0x05).Self.Path"') do (SET DocumentsFolder=%%g)
if not exist "%DocumentsFolder%\QSC\Q-Sys Designer\Plugins\%~2" mkdir "%DocumentsFolder%\QSC\Q-Sys Designer\Plugins\%~2"
:: This line writes/overwrites any existing file without locking it
:: This introduced errors where on a file changed notification, TYPE wasn't finished, and QSD would see a partial script and
:: throw an error. It would recover on the subsequent file changed notifications when the file was completely written.
:: TYPE "C:\plugins-layout-test\%1\%1.qplug" > "%userprofile%\Documents\QSC\Q-Sys Designer\Plugins\%1\%1.qplug"
:: As a solution, this line was added to write/overwrite files and lock them so that QSD couldn't access them until it was finished.
:: QSD was then throwing an access error while the file was being written, so I added code in C# to catch access denied errors,
:: in favour of waiting for the next changed notification that allowed the file to be read (i.e. file copying finished)
COPY /Y "%~1\%~2.qplug" "%DocumentsFolder%\QSC\Q-Sys Designer\Plugins\%~2\%~2.qplug"