diff --git a/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorExternalState.java b/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorExternalState.java index 799c63b0..0eacfe36 100644 --- a/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorExternalState.java +++ b/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorExternalState.java @@ -169,8 +169,8 @@ private void openFile(String file) { try { var command = SystemUtils.IS_OS_WINDOWS ? - List.of("cmd.exe", "/c", "start \"\" \"" + editor + "\" \"" + file + "\"") : - List.of("sh","-c", "\"" + editor + "\" \"" + file + "\""); + List.of("cmd.exe", "/c", "start \"\" \"" + editor + "\" \"" + file + "\"") : SystemUtils.IS_OS_LINUX ? + List.of("sh", "-c", "\"" + editor + "\" \"" + file + "\"") : List.of("open", "-a", editor, file); logger.trace("Executing command: " + command); Runtime.getRuntime().exec(command.toArray(String[]::new)); } catch (IOException e) { diff --git a/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorSettings.java b/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorSettings.java index 6947829f..c98330e1 100644 --- a/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorSettings.java +++ b/pdxu-editor/src/main/java/com/crschnick/pdxu/editor/EditorSettings.java @@ -97,6 +97,10 @@ private static String getDefaultEditor() { return "notepad"; } + if (SystemUtils.IS_OS_MAC) { + return "TextEdit.app"; + } + return System.getenv("VISUAL") != null ? System.getenv("VISUAL") : null; }