| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- @echo off
- setlocal enabledelayedexpansion
- echo QDR Temporary Shared Storage Plugin Packager
- echo ===========================================
- echo.
- :: Get plugin name from parent directory
- for %%I in ("%CD%") do set PLUGIN_NAME=%%~nxI
- :: Set other variables
- set DEPLOY_DIR=D:\Deploy
- set CURRENT_DIR=%CD%
- set TARGET_ZIP=%DEPLOY_DIR%\%PLUGIN_NAME%.zip
- set SCRIPT_NAME=%~nx0
- echo Plugin name detected as: %PLUGIN_NAME%
- echo.
- :: Create deploy directory if it doesn't exist
- if not exist "%DEPLOY_DIR%" (
- echo Creating deploy directory %DEPLOY_DIR%...
- mkdir "%DEPLOY_DIR%"
- )
- :: Remove existing ZIP if it exists
- if exist "%TARGET_ZIP%" (
- echo Removing existing archive...
- del "%TARGET_ZIP%"
- )
- :: Create temporary directory structure for packaging
- set TEMP_DIR=%TEMP%\plugin_package
- set PLUGIN_TEMP_DIR=%TEMP_DIR%\%PLUGIN_NAME%
- :: Clean up any existing temporary directories
- if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"
- mkdir "%TEMP_DIR%"
- mkdir "%PLUGIN_TEMP_DIR%"
- echo Copying plugin files to temporary directory...
- :: Copy all files and directories except excluded ones
- for /d %%D in (*) do (
- if /i not "%%D"=="@documentation" (
- xcopy "%%D" "%PLUGIN_TEMP_DIR%\%%D\" /E /I /H /Y >nul
- )
- )
- :: Copy individual files except the script itself
- for %%F in (*.*) do (
- if /i not "%%F"=="%SCRIPT_NAME%" (
- copy "%%F" "%PLUGIN_TEMP_DIR%\" >nul
- )
- )
- echo Creating ZIP archive...
- :: Create ZIP file using PowerShell (this will include the plugin directory)
- powershell -Command "Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory('%TEMP_DIR%', '%TARGET_ZIP%')"
- :: Clean up temporary directories
- rmdir /s /q "%TEMP_DIR%"
- :: Verify creation and display result
- if exist "%TARGET_ZIP%" (
- echo.
- echo Package created successfully: %TARGET_ZIP%
- echo Size:
- for %%A in ("%TARGET_ZIP%") do echo %%~zA bytes
- ) else (
- echo.
- echo ERROR: Failed to create package!
- )
- echo.
- echo Process complete.
- endlocal
|