From 05d93c7fa1be9245dd5211b7dc1bdf0961b39eea Mon Sep 17 00:00:00 2001 From: number Zero Date: Wed, 13 Sep 2017 23:03:18 +0300 Subject: Load files from subfolders in texturepacks Updated and rebased version of a PR by red-001 --- src/filesys.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/filesys.h') diff --git a/src/filesys.h b/src/filesys.h index 5f246e387..09f129aa3 100644 --- a/src/filesys.h +++ b/src/filesys.h @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once +#include #include #include #include "exceptions.h" @@ -66,10 +67,23 @@ bool DeleteSingleFileOrEmptyDirectory(const std::string &path); // Returns path to temp directory, can return "" on error std::string TempPath(); +/* Returns a list of subdirectories, including the path itself, but excluding + hidden directories (whose names start with . or _) +*/ +void GetRecursiveDirs(std::vector &dirs, const std::string &dir); +std::vector GetRecursiveDirs(const std::string &dir); + /* Multiplatform */ -// The path itself not included -void GetRecursiveSubPaths(const std::string &path, std::vector &dst); +/* The path itself not included, returns a list of all subpaths. + dst - vector that contains all the subpaths. + list files - include files in the list of subpaths. + ignore - paths that start with these charcters will not be listed. +*/ +void GetRecursiveSubPaths(const std::string &path, + std::vector &dst, + bool list_files, + const std::set &ignore = {}); // Tries to delete all, returns false if any failed bool DeletePaths(const std::vector &paths); -- cgit v1.2.3