2014-06-20 01:30:09 +00:00
|
|
|
#pragma once
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_UTIL_H
|
|
|
|
#define ES_CORE_UTIL_H
|
2014-06-20 01:30:09 +00:00
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
2014-03-12 23:24:34 +00:00
|
|
|
|
2014-03-15 22:06:16 +00:00
|
|
|
std::string strToUpper(const char* from);
|
|
|
|
std::string& strToUpper(std::string& str);
|
2014-03-19 20:03:23 +00:00
|
|
|
std::string strToUpper(const std::string& str);
|
|
|
|
|
2014-06-02 18:55:00 +00:00
|
|
|
std::string getCanonicalPath(const std::string& str);
|
|
|
|
|
2016-08-09 20:26:30 +00:00
|
|
|
boost::filesystem::path removeCommonPathUsingStrings(const boost::filesystem::path& path, const boost::filesystem::path& relativeTo, bool& contains);
|
2014-06-02 18:55:00 +00:00
|
|
|
// example: removeCommonPath("/home/pi/roms/nes/foo/bar.nes", "/home/pi/roms/nes/") returns "foo/bar.nes"
|
|
|
|
boost::filesystem::path removeCommonPath(const boost::filesystem::path& path, const boost::filesystem::path& relativeTo, bool& contains);
|
|
|
|
|
|
|
|
// usage: makeRelativePath("/path/to/my/thing.sfc", "/path/to") -> "./my/thing.sfc"
|
|
|
|
// usage: makeRelativePath("/home/pi/my/thing.sfc", "/path/to", true) -> "~/my/thing.sfc"
|
|
|
|
boost::filesystem::path makeRelativePath(const boost::filesystem::path& path, const boost::filesystem::path& relativeTo, bool allowHome);
|
|
|
|
|
|
|
|
// expands "./my/path.sfc" to "[relativeTo]/my/path.sfc"
|
|
|
|
// if allowHome is true, also expands "~/my/path.sfc" to "/home/pi/my/path.sfc"
|
|
|
|
boost::filesystem::path resolvePath(const boost::filesystem::path& path, const boost::filesystem::path& relativeTo, bool allowHome);
|
2014-06-20 01:30:09 +00:00
|
|
|
|
2017-06-12 16:38:59 +00:00
|
|
|
std::string escapePath(const boost::filesystem::path& path);
|
|
|
|
|
|
|
|
std::string strreplace(std::string str, const std::string& replace, const std::string& with);
|
|
|
|
|
|
|
|
// Remove (.*) and [.*] from str
|
|
|
|
std::string removeParenthesis(const std::string& str);
|
|
|
|
|
|
|
|
// split a comma-separated string into a vector
|
|
|
|
std::vector<std::string> commaStringToVector(std::string commaString);
|
|
|
|
|
|
|
|
// turn a vector of strings into a comma-separated string
|
2017-10-31 17:12:50 +00:00
|
|
|
std::string vectorToCommaString(std::vector<std::string> stringVector);
|
|
|
|
|
|
|
|
#endif // ES_CORE_UTIL_H
|