xdg: remove memoize.
							parent
							
								
									5a420cabc3
								
							
						
					
					
						commit
						f3d1d785cd
					
				| 
						 | 
				
			
			@ -1,29 +1,29 @@
 | 
			
		|||
! Copyright (C) 2015 John Benediktsson
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license
 | 
			
		||||
 | 
			
		||||
USING: environment memoize sequences splitting ;
 | 
			
		||||
USING: environment sequences splitting ;
 | 
			
		||||
 | 
			
		||||
IN: xdg
 | 
			
		||||
 | 
			
		||||
! http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-data-home ( -- path )
 | 
			
		||||
: xdg-data-home ( -- path )
 | 
			
		||||
    "XDG_DATA_HOME" os-env [ "~/.local/share" ] when-empty ;
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-config-home ( -- path )
 | 
			
		||||
: xdg-config-home ( -- path )
 | 
			
		||||
    "XDG_CONFIG_HOME" os-env [ "~/.config" ] when-empty ;
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-cache-home ( -- path )
 | 
			
		||||
: xdg-cache-home ( -- path )
 | 
			
		||||
    "XDG_CACHE_HOME" os-env [ "~/.cache" ] when-empty ;
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-data-dirs ( -- paths )
 | 
			
		||||
: xdg-data-dirs ( -- paths )
 | 
			
		||||
    "XDG_DATA_DIRS" os-env ":" split harvest
 | 
			
		||||
    [ { "/usr/local/share" "/usr/share" } ] when-empty ;
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-config-dirs ( -- paths )
 | 
			
		||||
: xdg-config-dirs ( -- paths )
 | 
			
		||||
    "XDG_CONFIG_DIRS" os-env ":" split harvest
 | 
			
		||||
    [ { "/etc/xdg" } ] when-empty ;
 | 
			
		||||
 | 
			
		||||
MEMO: xdg-runtime-dir ( -- path/f )
 | 
			
		||||
: xdg-runtime-dir ( -- path/f )
 | 
			
		||||
    "XDG_RUNTIME_DIR" os-env ;
 | 
			
		||||
    ! TODO: check runtime secure permissions
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue