Skip to content

Commit

Permalink
Add powershell equivalents to existing batch scripts (#2561)
Browse files Browse the repository at this point in the history
* Add powershell equivalents to existing windows scripts

Each .bat will try to invoke its .ps1 version if powershell is available, or else will fallback on the behavior
previous to this commit.
Should help fix bugs with accents and non-ASCII characters (issue #2327).

* Add powershell equivalents to existing windows scripts

Each .bat will try to invoke its .ps1 version if powershell is available, or else will fallback on the behavior
previous to this commit.
Should help fix bugs with accents and non-ASCII characters (issue #2327).

Co-authored-by: zadam <zadam.apps@gmail.com>
  • Loading branch information
rrouviere and zadam authored Jan 17, 2022
1 parent 3055ed8 commit 780b520
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
4 changes: 1 addition & 3 deletions bin/build-win-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ rm -r $BUILD_DIR/swiftshader

cp bin/tpl/anonymize-database.sql $BUILD_DIR/

cp bin/tpl/trilium-portable.bat $BUILD_DIR/
cp bin/tpl/trilium-no-cert-check.bat $BUILD_DIR/
cp bin/tpl/trilium-safe-mode.bat $BUILD_DIR/
cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.{bat,ps1} $BUILD_DIR/

echo "Zipping windows x64 electron distribution..."
VERSION=`jq -r ".version" package.json`
Expand Down
3 changes: 2 additions & 1 deletion bin/tpl/trilium-no-cert-check.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SET DIR=%~dp0
set NODE_TLS_REJECT_UNAUTHORIZED=0
cd %DIR%
start trilium.exe
WHERE powershell.exe
IF %ERRORLEVEL% NEQ 0 (start trilium.exe) ELSE (powershell.exe ./trilium-no-cert-check.ps1)
2 changes: 2 additions & 0 deletions bin/tpl/trilium-no-cert-check.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set-Item -Path Env:NODE_TLS_REJECT_UNAUTHORIZED -Value 0
./trilium.exe
3 changes: 2 additions & 1 deletion bin/tpl/trilium-portable.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SET DIR=%~dp0
SET TRILIUM_DATA_DIR=%DIR%\trilium-data
cd %DIR%
start trilium.exe
WHERE powershell.exe
IF %ERRORLEVEL% NEQ 0 (start trilium.exe) ELSE (powershell.exe ./trilium-portable.ps1)
2 changes: 2 additions & 0 deletions bin/tpl/trilium-portable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set-Item -Path Env:TRILIUM_DATA_DIR -Value './trilium-data'
./trilium.exe
3 changes: 2 additions & 1 deletion bin/tpl/trilium-safe-mode.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SET DIR=%~dp0
SET TRILIUM_SAFE_MODE=1
cd %DIR%
start trilium.exe
WHERE powershell.exe
IF %ERRORLEVEL% NEQ 0 (start trilium.exe) ELSE (powershell.exe ./trilium-safe-mode.ps1)
2 changes: 2 additions & 0 deletions bin/tpl/trilium-safe-mode.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set-Item -Path Env:TRILIUM_SAFE_MODE -Value 1
./trilium.exe

0 comments on commit 780b520

Please sign in to comment.