mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 14:18:38 +01:00
Improve usage of test-path
This commit is contained in:
parent
a39508856b
commit
7a57971d0c
@ -14,7 +14,7 @@ try {
|
||||
$User = $(whoami)
|
||||
$Line = "$Time,$User,$Text"
|
||||
|
||||
if (-not(test-path "$Path")) {
|
||||
if (-not(test-path "$Path" -pathType leaf)) {
|
||||
write-output "Time,User,Text" > "$Path"
|
||||
}
|
||||
write-output $Line >> "$Path"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
if (test-path "/sys/class/thermal/thermal_zone0/temp") {
|
||||
if (test-path "/sys/class/thermal/thermal_zone0/temp" -pathType leaf) {
|
||||
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
||||
$Temp = [math]::round($IntTemp / 1000.0, 1)
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
try {
|
||||
$Path = "$HOME/Memos.csv"
|
||||
if (test-path "$Path") {
|
||||
if (test-path "$Path" -pathType leaf) {
|
||||
write-progress "Reading $Path ..."
|
||||
$Table = import-csv "$Path"
|
||||
write-progress -completed "Reading $Path"
|
||||
|
@ -9,7 +9,7 @@ param($RepoDir = "$PWD")
|
||||
|
||||
function MakeDir { param($Path)
|
||||
$DirName = (get-item "$Path").Name
|
||||
if (test-path "$Path/CMakeLists.txt") {
|
||||
if (test-path "$Path/CMakeLists.txt" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using CMakeLists.txt to subfolder BuildFiles..."
|
||||
if (-not(test-path "$Path/BuildFiles/" -pathType container)) {
|
||||
& mkdir "$Path/BuildFiles/"
|
||||
@ -25,7 +25,7 @@ function MakeDir { param($Path)
|
||||
& make test
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/configure") {
|
||||
} elseif (test-path "$Path/configure" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using 'configure'..."
|
||||
set-location "$Path/"
|
||||
|
||||
@ -35,7 +35,7 @@ function MakeDir { param($Path)
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/autogen.sh") {
|
||||
} elseif (test-path "$Path/autogen.sh" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using 'autogen.sh'..."
|
||||
set-location "$Path/"
|
||||
|
||||
@ -45,7 +45,7 @@ function MakeDir { param($Path)
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/build.gradle") {
|
||||
} elseif (test-path "$Path/build.gradle" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using build.gradle..."
|
||||
set-location "$Path"
|
||||
|
||||
@ -55,7 +55,7 @@ function MakeDir { param($Path)
|
||||
& gradle test
|
||||
if ($lastExitCode -ne "0") { throw "'gradle test' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/Imakefile") {
|
||||
} elseif (test-path "$Path/Imakefile" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using Imakefile..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
@ -65,14 +65,14 @@ function MakeDir { param($Path)
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/Makefile") {
|
||||
} elseif (test-path "$Path/Makefile" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using Makefile..."
|
||||
set-location "$Path"
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/compile.sh") {
|
||||
} elseif (test-path "$Path/compile.sh" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using 'compile.sh'..."
|
||||
set-location "$Path/"
|
||||
|
||||
@ -82,7 +82,7 @@ function MakeDir { param($Path)
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$Path/attower/src/build/DevBuild/build.bat") {
|
||||
} elseif (test-path "$Path/attower/src/build/DevBuild/build.bat" -pathType leaf) {
|
||||
"⏳ Building 📂$DirName using build.bat ..."
|
||||
set-location "$Path/attower/src/build/DevBuild/"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user