]> gitweb.factorcode.org Git - factor.git/commitdiff
system-info: Add a cross-platform username hook.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jan 2021 00:36:27 +0000 (18:36 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jan 2021 00:36:27 +0000 (18:36 -0600)
basis/system-info/system-info.factor
basis/system-info/windows/windows.factor

index 7c2d9bdbe3730c9e2b0b4ac483ab58d183eeda5b..ba52b23003a5a1e612136bb5ad2d239cd53148a4 100644 (file)
@@ -16,6 +16,7 @@ HOOK: total-virtual-mem os ( -- n )
 HOOK: available-virtual-mem os ( -- n )
 HOOK: available-virtual-extended-mem os ( -- n )
 HOOK: computer-name os ( -- string )
+HOOK: username os ( -- string )
 
 : write-unit ( x n str -- )
     [ 2^ /f number>string write bl ] [ write ] bi* ;
index 2c719fb4d90d1b65a741b09f11011a52cc22de19..d9f9317fb843c5903f39573043cbf099171049d4 100644 (file)
@@ -101,7 +101,7 @@ M: windows computer-name
     [ <byte-array> dup ] keep uint <ref>
     GetComputerName win32-error=0/f alien>native-string ;
 
-: username ( -- string )
+M: windows username ( -- string )
     UNLEN 1 +
     [ <byte-array> dup ] keep uint <ref>
     GetUserName win32-error=0/f alien>native-string ;