]> gitweb.factorcode.org Git - factor.git/commitdiff
drive-strings: add a demo vocab for GetLogicalDriveStrings to extra
authorAlexander Iljin <ajsoft@yandex.ru>
Fri, 9 Aug 2019 06:20:00 +0000 (08:20 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Apr 2020 19:33:42 +0000 (19:33 +0000)
extra/drive-strings/authors.txt [new file with mode: 0644]
extra/drive-strings/drive-strings.factor [new file with mode: 0644]
extra/drive-strings/platforms.txt [new file with mode: 0644]

diff --git a/extra/drive-strings/authors.txt b/extra/drive-strings/authors.txt
new file mode 100644 (file)
index 0000000..8e1955f
--- /dev/null
@@ -0,0 +1 @@
+Alexander Ilin
diff --git a/extra/drive-strings/drive-strings.factor b/extra/drive-strings/drive-strings.factor
new file mode 100644 (file)
index 0000000..d436a8a
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2019 Alexander Ilin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: byte-arrays io.encodings.string io.encodings.utf16
+kernel math sequences splitting windows.kernel32 ;
+IN: drive-strings
+
+: logical-drive-strings ( -- seq )
+    30 4 2 * * dup <byte-array> [ GetLogicalDriveStrings ] keep
+    utf16le decode swap head "\0" split harvest ;
diff --git a/extra/drive-strings/platforms.txt b/extra/drive-strings/platforms.txt
new file mode 100644 (file)
index 0000000..8e1a559
--- /dev/null
@@ -0,0 +1 @@
+windows