gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

filesystem.h (1784B)


      1 #pragma once
      2 
      3 #include <string>
      4 #include <vector>
      5 #include <cstdint>
      6 #include <cstddef>
      7 #include <array>
      8 
      9 namespace baseLib
     10 {
     11 	namespace filesystem
     12 	{
     13 		std::string getCurrentDirectory();
     14 		bool createDirectory(const std::string& _dir);
     15 		std::string validatePath(std::string _path);
     16 
     17 		std::string lowercase(const std::string &_src);
     18 
     19 		std::string getExtension(const std::string& _name);
     20 		std::string stripExtension(const std::string& _name);
     21 		std::string getFilenameWithoutPath(const std::string& _name);
     22 		std::string getPath(const std::string& _filename);
     23 
     24 		bool getDirectoryEntries(std::vector<std::string>& _files, const std::string& _folder);
     25 
     26 		bool findFiles(std::vector<std::string>& _files, const std::string& _rootPath, const std::string& _extension, size_t _minSize, size_t _maxSize);
     27 		std::string findFile(const std::string& _rootPath, const std::string& _extension, const size_t _minSize, const size_t _maxSize);
     28 
     29 		bool hasExtension(const std::string& _filename, const std::string& _extension);
     30 		size_t getFileSize(const std::string& _file);
     31 
     32 		bool isDirectory(const std::string& _path);
     33 
     34 		bool writeFile(const std::string& _filename, const std::vector<uint8_t>& _data);
     35 		bool writeFile(const std::string& _filename, const uint8_t* _data, size_t _size);
     36 
     37 		template<size_t Size> bool writeFile(const std::string& _filename, const std::array<uint8_t, Size>& _data)
     38 		{
     39 			return writeFile(_filename, &_data[0], _data.size());
     40 		}
     41 
     42 		bool readFile(std::vector<uint8_t>& _data, const std::string& _filename);
     43 
     44 		FILE* openFile(const std::string& _name, const char* _mode);
     45 
     46 		enum class SpecialFolderType : uint8_t
     47 		{
     48 			UserDocuments,
     49 			PrivateAppData
     50 		};
     51 
     52 		std::string getHomeDirectory();
     53 		std::string getSpecialFolderPath(SpecialFolderType _type);
     54 	};
     55 }