@@ -4,15 +4,15 @@ module paths
44 using LoggingExtras
55
66 # AGNI root directory (constant)
7- const ROOT_DIR:: String = abspath (dirname (abspath (@__FILE__ )), " .." , " .." )
7+ const ROOT_DIR:: String = normpath ( abspath (dirname (abspath (@__FILE__ )), " .." , " .." ) )
88 export ROOT_DIR
99
1010 # Resources directory (constant)
11- const RES_DIR:: String = joinpath (ROOT_DIR, " res" )
11+ const RES_DIR:: String = normpath ( joinpath (ROOT_DIR, " res" ) )
1212 export RES_DIR
1313
1414 # FWL_DATA folder (fall back to RES_DIR if not set)
15- const FWL_DATA:: String = joinpath (get (ENV , " FWL_DATA" , RES_DIR))
15+ const FWL_DATA:: String = normpath ( joinpath (get (ENV , " FWL_DATA" , RES_DIR) ))
1616 export FWL_DATA
1717
1818 """
@@ -62,28 +62,30 @@ module paths
6262 """
6363 function is_safe_dir (path:: String ):: Bool
6464 # Do not allow empty paths
65- ! isempty (path) || return false
65+ isempty (path) && return false
6666
6767 # Normalise path for other checks...
68- path = abspath (path)
68+ path = normpath ( abspath (path) )
6969
7070 # Contains git repo
7171 ispath (joinpath (path, " .git" )) && return false
7272
7373 # Is current working directory
74- (joinpath ( path) == pwd ()) && return false
74+ (path == pwd ()) && return false
7575
7676 # Is system root directory
77- (path == " /" ) && return false
77+ (path == normpath ( " /" ) ) && return false
7878
7979 # Is user home directory
8080 (path == homedir ()) && return false
8181
8282 # Is AGNI root directory
83- (path == abspath ( paths. ROOT_DIR) ) && return false
83+ (path == paths. ROOT_DIR) && return false
8484
8585 # Is AGNI resources directory
86- (path == abspath (paths. RES_DIR)) && return false
86+ (path == paths. RES_DIR) && return false
87+
88+ return true
8789 end
8890 export is_safe_dir
8991
0 commit comments