1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 20:33:01 +02:00

🔀 Merge branch 'main' into dev/5.x

This commit is contained in:
2021-12-23 20:19:21 +01:00
11 changed files with 206 additions and 103 deletions

View File

@@ -109,7 +109,8 @@ public class Shell {
Uses `/bin/echo` instead of the `builtin` (which does not support `-n`).
*/
public static func fileExists(_ path: String) -> Bool {
return Shell.pipe("if [ -f \(path) ]; then /bin/echo -n \"0\"; fi") == "0"
let escapedPath = path.replacingOccurrences(of: " ", with: "\\ ")
return Shell.pipe("if [ -f \(escapedPath) ]; then /bin/echo -n \"0\"; fi") == "0"
}
/**