browse_files() now allows transfer of .json files (#15411)

This commit is contained in:
dearmochi
2021-02-01 19:45:00 +00:00
committed by GitHub
parent 1d89138436
commit 5c5c306a60
+3 -2
View File
@@ -17,7 +17,7 @@
for(var/file in args)
src << browse_rsc(file)
/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list(".txt",".log",".htm"))
/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list("txt", "log", "htm", "json"))
// wow why was this ever a parameter
root = "data/logs/"
var/path = root
@@ -39,7 +39,8 @@
if(copytext(path,-1,0) != "/") //didn't choose a directory, no need to iterate again
break
var/extension = copytext(path,-4,0)
var/list/exploded = splittext(path, ".")
var/extension = exploded[length(exploded)]
if( !fexists(path) || !(extension in valid_extensions) )
to_chat(src, "<font color='red'>Error: browse_files(): File not found/Invalid file([path]).</font>")
return