-
-
Save fireundubh/667b685ad9f5e3358a9b596b42036949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL | |
SET compiler="D:\Steam\steamapps\common\Fallout 4\Papyrus Compiler\PapyrusCompiler.exe" | |
SET flags="D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\Base\Institute_Papyrus_Flags.flg" | |
SET imports="D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User;D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\Base" | |
SET projects="D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\Projects" | |
SET output="D:\Steam\steamapps\common\Fallout 4\Data\Scripts" | |
CALL :ExpandPath %1 | |
IF [%1] == [] ( | |
ECHO. & ECHO Compiling... %CD% | |
%compiler% %CD% -all -op -o=%output% -i=%imports% -f=%flags% -release -final -q | |
) ELSE IF [%sourceExtension%] == [.psc] ( | |
ECHO. & ECHO Compiling... %sourceFile:"=% | |
%compiler% "%sourceFile%" -op -o=%output% -i=%imports% -f=%flags% -release -final -q | |
IF EXIST %binaryPath% ( | |
ECHO Operation succeeded. | |
) ELSE ( | |
ECHO Operation failed. File does not exist: %binaryPath:"=% | |
GOTO Done | |
) | |
IF [%2] == [--test] ( | |
IF EXIST %binaryPath% ( | |
ECHO. & ECHO Removing compiled script... | |
DEL %binaryPath% | |
) | |
IF NOT EXIST %binaryPath% ( | |
ECHO Operation succeeded. | |
GOTO Done | |
) ELSE ( | |
ECHO Operation failed. File exists: %binaryPath:"=% | |
GOTO Done | |
) | |
) | |
) ELSE IF [%sourceExtension%] == [.ppj] ( | |
ECHO. & ECHO Compiling... %projects:"=%\%sourceFile:"=% | |
%compiler% "%projects:"=%\%sourceFile:"=%" -q | |
) ELSE ( | |
ECHO. & ECHO Compiling... %1 | |
%compiler% "%1" -all -op -o=%output% -i=%imports% -f=%flags% -release -final -q | |
) | |
:Done | |
FOR /f "tokens=2-4 delims=/ " %%a IN ('date /t') do (SET finishDate=%%c-%%a-%%b) | |
FOR /f "tokens=1-2 delims=/:" %%a IN ('time /t') do (SET finishTime=%%a:%%b) | |
ECHO. & ECHO Done. [ %finishDate% %finishTime% ] | |
ENDLOCAL | |
:ExpandPath | |
SET sourceFolder=%~dp1 | |
SET sourceFile=%~nx1 | |
SET sourceExtension=%~x1 | |
IF [%sourceExtension%] == [.psc] ( | |
SET binaryPath="%output:"=%\%sourceFile:.psc=.pex%" | |
) ELSE ( | |
SET binaryPath="%sourceFolder%%sourceFile%" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment