From 5c5c306a603fc4ce77552fda20534c2d3beb486a Mon Sep 17 00:00:00 2001 From: dearmochi Date: Mon, 1 Feb 2021 20:45:00 +0100 Subject: [PATCH] browse_files() now allows transfer of .json files (#15411) --- code/__HELPERS/files.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/files.dm b/code/__HELPERS/files.dm index 0a58ed035f7..04330b7805c 100644 --- a/code/__HELPERS/files.dm +++ b/code/__HELPERS/files.dm @@ -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, "Error: browse_files(): File not found/Invalid file([path]).") return