]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/editors/notepadnext/notepadnext.factor
editors.notepadnext: add support for NotepadNext
[factor.git] / basis / editors / notepadnext / notepadnext.factor
diff --git a/basis/editors/notepadnext/notepadnext.factor b/basis/editors/notepadnext/notepadnext.factor
new file mode 100644 (file)
index 0000000..66157c4
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2024 Doug Coleman.
+! See https://factorcode.org/license.txt for BSD license.
+USING: editors io.pathnames io.standard-paths kernel make system ;
+IN: editors.notepadnext
+
+SINGLETON: notepadnext
+
+HOOK: find-notepadnext-path os ( -- path )
+
+M: macosx find-notepadnext-path
+    "com.yourcompany.NotepadNext" find-native-bundle [
+        "Contents/MacOS/NotepadNext" append-path
+    ] [
+        f
+    ] if* ;
+
+M: windows find-notepadnext-path
+    { "Notepad Next" } "NotepadNext.exe" find-in-applications
+    [ "NotepadNext.exe" ] unless* ;
+
+M: linux find-notepadnext-path
+    "NotepadNext" find-in-path ;
+
+M: notepadnext editor-command
+    '[
+        find-notepadnext-path ,
+        _ ,
+        _ drop ! "-n" , _ ,
+    ] { } make ;