mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-13 14:30:06 +02:00
👌 Clean up how file checks are done
This commit is contained in:
@@ -73,10 +73,9 @@ class Shell {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Checks if a file exists at the provided path.
|
Checks if a file exists at the provided path.
|
||||||
|
Uses `/bin/echo` instead of the `builtin` (which does not support `-n`).
|
||||||
*/
|
*/
|
||||||
public static func fileExists(_ path: String) -> Bool {
|
public static func fileExists(_ path: String) -> Bool {
|
||||||
return Shell.pipe(
|
return Shell.pipe("if [ -f \(path) ]; then /bin/echo -n \"0\"; fi") == "0"
|
||||||
"if [ -f \(path) ]; then echo \"PHP_Y_FE\"; fi"
|
|
||||||
).contains("PHP_Y_FE")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user